Is it possible to sort by a hidden field in a TreeGrid? In this code sample I am trying to sort by the field sortOrder. Sorting only seems to work if the field is visible. I would prefer not to show the field as it would not be relevant to the user.
Code:
TreeGrid treeGrid = new TreeGrid();
treeGrid.setCanEdit(false);
treeGrid.setLoadDataOnDemand(false);
treeGrid.setWidth100();
treeGrid.setHeight(400);
treeGrid.setDataSource(datasource);
treeGrid.setNodeIcon("icons/16/person.png");
treeGrid.setFolderIcon("icons/16/person.png");
treeGrid.setShowOpenIcons(false);
treeGrid.setShowDropIcons(false);
treeGrid.setClosedIconSuffix("");
treeGrid.setAutoFetchData(true);
treeGrid.setShowHeader(true);
TreeGridField nameField = new TreeGridField("name");
TreeGridField sortOrder = new TreeGridField("sortOrder");
sortOrder.setName("sortOrder");
sortOrder.setHidden(true);
nameField.setCanSort(false);
treeGrid.setFields(nameField, sortOrder);
treeGrid.setSortField("sortOrder");
treeGrid.setSortDirection(SortDirection.ASCENDING);
Comment