Hi everyone,
I have a TreeGrid with a DataSource, and use the native filterData() function to filter the content being displayed to match a given keyword. Parent folders are kept, and children ones are (obvisouly) not retrieved. But my need is to keep the children folders and leaves displayed, to allow the user to explore the content below the folders which match his keyword. (Like a setKeepParentsOnFilter() but setKeepChildrenOnFilter().)
So in the callback of filterData(), my idea is to reload/refresh the content of the folder which match the keyword, but how should I do that ?...
Any help will be much appreciated ! Thanks.
Elie
(gwt.version : 2.8.0)
I have a TreeGrid with a DataSource, and use the native filterData() function to filter the content being displayed to match a given keyword. Parent folders are kept, and children ones are (obvisouly) not retrieved. But my need is to keep the children folders and leaves displayed, to allow the user to explore the content below the folders which match his keyword. (Like a setKeepParentsOnFilter() but setKeepChildrenOnFilter().)
So in the callback of filterData(), my idea is to reload/refresh the content of the folder which match the keyword, but how should I do that ?...
Any help will be much appreciated ! Thanks.
Elie
(gwt.version : 2.8.0)
Code:
globalTreeGrid.filterData(new TreeFilter( fieldToDisplay, selectionType, flatten, filterTextItemId.getValueAsString(), filterTextItemLabel.getValueAsString(), allowVirtualFolders), new DSCallback() { @Override public void execute(DSResponse response, Object rawData, DSRequest request) { for (Record record : response.getData()){ boolean isFolder = record.getAttributeAsBoolean("isFolder"); String shortdesc = record.getAttributeAsString("shortdesc"); String filterTextItemLabelValue = filterTextItemLabel.getValueAsString(); if (filterTextItemLabel != null && isFolder && shortdesc != null && shortdesc.contains(filterTextItemLabelValue)){ TreeNode wantedNode = globalTreeGrid.getData().findById(record.getAttributeAsString("id")); boolean isLoaded = globalTreeGrid.getData().isLoaded(wantedNode); globalTreeGrid.refreshData();//ineffective globalTreeGrid.openFolder(wantedNode); } } globalTreeGrid.fireEvent(new ItemsCounterEvent(response.getTotalRows())); } });
Comment