src/main/java/org/efaps/ui/wicket/components/gridx/GridXComponent.java
public static CharSequence getDataReloadJS(final UIGrid _uiGrid)
        throws EFapsException
    {
        final StringBuilder js = new StringBuilder()
            .append("var grid = registry.byId('grid');\n")
            .append("var items = ").append(GridXComponent.getDataJS(_uiGrid));

        final StringBuilder dialogJs = new StringBuilder();
        if (!_uiGrid.isColumnsUpToDate()) {
            // lazy setting of data type when first time data
            _uiGrid.setColumnsUpToDate(true);
            js.append("array.forEach(grid.structure, function(entry){\n");
            for (final GridColumn column : _uiGrid.getColumns()) {
                if (column.getDataType() != null) {
                    js.append("if ('").append(column.getField().getId()).append("'== entry.id) {\n")
                        .append("entry.dataType='").append(column.getDataType()).append("';\n")
                        .append("entry.comparator = grid.comparators.").append(column.getDataType()).append(";\n")
                        .append("}\n");
                }
                if (_uiGrid.getFilterList().stream()
                                .filter(filter -> filter.getFieldId() == column.getField().getId())
                                .findFirst().isPresent()) {
                    // to prevent jumping of the modal filter dialog, close and open it
                    final String varName = RandomUtil.randomAlphabetic(4);
                    dialogJs.append("var ").append(varName)
                        .append(" = registry.byId('").append("fttd_" + column.getField().getId()).append("');\n")
                        .append("if (").append(varName).append(" && !(").append(varName)
                            .append(".domNode.offsetHeight == 0 && ")
                            .append(varName).append(".domNode.offsetWidth == 0)) {\n")
                        .append(varName).append(".onBlur();\n")
                        .append("var nl = query(\".gridxHeaderMenuBtn\", dom.byId('grid-")
                            .append(column.getField().getId()).append("'));\n")
                        .append("nl[0].click();\n")
                        .append("}\n");
                }
            }
            js.append("});\n")
                .append("grid.setColumns(grid.structure);\n")
                .append(dialogJs);
        }
        js.append("grid.model.clearCache();\n")
            .append("grid.model.store.setData(items);\n")
            .append("grid.body.refresh();\n");
        return DojoWrapper.require(js, DojoClasses.registry, DojoClasses.array, DojoClasses.dom, DojoClasses.query);
    }
public static CharSequence getDataReloadJS(final UIGrid _uiGrid)
        throws EFapsException
    {
        final StringBuilder js = new StringBuilder()
            .append("var grid = registry.byId('grid');\n")
            .append("var items = ").append(GridXComponent.getDataJS(_uiGrid));

        final StringBuilder dialogJs = new StringBuilder();
        if (!_uiGrid.isColumnsUpToDate()) {
            // lazy setting of data type when first time data
            _uiGrid.setColumnsUpToDate(true);
            js.append("array.forEach(grid.structure, function(entry){\n");
            for (final GridColumn column : _uiGrid.getColumns()) {
                if (column.getDataType() != null) {
                    js.append("if ('").append(column.getField().getId()).append("'== entry.id) {\n")
                        .append("entry.dataType='").append(column.getDataType()).append("';\n")
                        .append("entry.comparator = grid.comparators.").append(column.getDataType()).append(";\n")
                        .append("}\n");
                }
                if (_uiGrid.getFilterList().stream()
                                .filter(filter -> filter.getFieldId() == column.getField().getId())
                                .findFirst().isPresent()) {
                    // to prevent jumping of the modal filter dialog, close and open it
                    final String varName = RandomUtil.randomAlphabetic(4);
                    dialogJs.append("var ").append(varName)
                        .append(" = registry.byId('").append("fttd_" + column.getField().getId()).append("');\n")
                        .append("if (").append(varName).append(" && !(").append(varName)
                            .append(".domNode.offsetHeight == 0 && ")
                            .append(varName).append(".domNode.offsetWidth == 0)) {\n")
                        .append(varName).append(".onBlur();\n")
                        .append("var nl = query(\".gridxHeaderMenuBtn\", dom.byId('grid-")
                            .append(column.getField().getId()).append("'));\n")
                        .append("nl[0].click();\n")
                        .append("}\n");
                }
            }
            js.append("});\n")
                .append("grid.setColumns(grid.structure);\n")
                .append(dialogJs);
        }
        js.append("grid.model.clearCache();\n")
            .append("grid.model.store.setData(items);\n")
            .append("grid.body.refresh();\n");
        return DojoWrapper.require(js, DojoClasses.registry, DojoClasses.array, DojoClasses.dom, DojoClasses.query);
    }
Gets the javascript.

@param _uiGrid the ui grid
@return the javascript
@throws EFapsException on error