src/main/java/org/efaps/ui/wicket/components/gridx/GridXComponent.java
protected CharSequence getPersistenceScript(final UIGrid _uiGrid)
        throws EFapsException
    {
        final StringBuilder ret = new StringBuilder();
        ret.append("persistGet: function(_key) {");
        if (Context.getThreadContext().containsUserAttribute(_uiGrid.getCacheKey(CacheKey.GRIDX))) {
            final Set<Long> colIds = _uiGrid.getColumns()
                            .stream()
                            .map(col -> col.getField().getId())
                            .collect(Collectors.toSet());
            boolean add = true;
            final JSONObject json = new JSONObject(new JSONTokener(Context.getThreadContext().getUserAttribute(
                            _uiGrid.getCacheKey(CacheKey.GRIDX))));
            final JSONArray columnsArray = json.getJSONArray("column");
            for (int i = 0; i < columnsArray.length(); i++) {
                final JSONObject colObj = (JSONObject) columnsArray.get(i);
                final Long colid = colObj.getLong("id");
                if (!colIds.contains(colid)) {
                    add = false;
                    break;
                }
            }
            if (add && !json.isNull("filterBar")) {
                final JSONObject filterBar =  json.getJSONObject("filterBar");
                if (!filterBar.isNull("conditions")) {
                    final JSONArray conditionsArray = filterBar.getJSONArray("conditions");
                    for (int i = 0; i < conditionsArray.length(); i++) {
                        final JSONObject colObj = (JSONObject) conditionsArray.get(i);
                        if (colObj.has("colId")) {
                            final Long colid = colObj.optLong("colId");
                            if (colid > 0 && !colIds.contains(colid)) {
                                add = false;
                                break;
                            }
                        }
                    }
                }
            }
            if (add) {
                ret.append("return ").append(json.toString());
            }
        }
        ret.append("},\n")
            .append("persistPut: function(_key, _value, _options) {\n")
            .append("  var value;")
            .append("  if(_value && lang.isObject(_value)){\n")
            .append("    value = json.toJson(_value);\n")
            .append("  }else{\n")
            .append("    value = {expires: -1};\n")
            .append("  }\n")
            .append("top.eFaps.persistUserAttr('")
                .append(_uiGrid.getCacheKey(CacheKey.GRIDX)).append("', value);")
            .append("},\n");
        return ret;
    }
protected CharSequence getPersistenceScript(final UIGrid _uiGrid)
        throws EFapsException
    {
        final StringBuilder ret = new StringBuilder();
        ret.append("persistGet: function(_key) {");
        if (Context.getThreadContext().containsUserAttribute(_uiGrid.getCacheKey(CacheKey.GRIDX))) {
            final Set<Long> colIds = _uiGrid.getColumns()
                            .stream()
                            .map(col -> col.getField().getId())
                            .collect(Collectors.toSet());
            boolean add = true;
            final JSONObject json = new JSONObject(new JSONTokener(Context.getThreadContext().getUserAttribute(
                            _uiGrid.getCacheKey(CacheKey.GRIDX))));
            final JSONArray columnsArray = json.getJSONArray("column");
            for (int i = 0; i < columnsArray.length(); i++) {
                final JSONObject colObj = (JSONObject) columnsArray.get(i);
                final Long colid = colObj.getLong("id");
                if (!colIds.contains(colid)) {
                    add = false;
                    break;
                }
            }
            if (add && !json.isNull("filterBar")) {
                final JSONObject filterBar =  json.getJSONObject("filterBar");
                if (!filterBar.isNull("conditions")) {
                    final JSONArray conditionsArray = filterBar.getJSONArray("conditions");
                    for (int i = 0; i < conditionsArray.length(); i++) {
                        final JSONObject colObj = (JSONObject) conditionsArray.get(i);
                        if (colObj.has("colId")) {
                            final Long colid = colObj.optLong("colId");
                            if (colid > 0 && !colIds.contains(colid)) {
                                add = false;
                                break;
                            }
                        }
                    }
                }
            }
            if (add) {
                ret.append("return ").append(json.toString());
            }
        }
        ret.append("},\n")
            .append("persistPut: function(_key, _value, _options) {\n")
            .append("  var value;")
            .append("  if(_value && lang.isObject(_value)){\n")
            .append("    value = json.toJson(_value);\n")
            .append("  }else{\n")
            .append("    value = {expires: -1};\n")
            .append("  }\n")
            .append("top.eFaps.persistUserAttr('")
                .append(_uiGrid.getCacheKey(CacheKey.GRIDX)).append("', value);")
            .append("},\n");
        return ret;
    }
Gets the persistence script.

@param _uiGrid the ui grid
@return the persistence script
@throws EFapsException the e faps exception