User View:
1 - TreeGrid (product group) is shown, user clicks on a treeItem.
2 - A ListGrid displays all available products. Based on the selected product group (1), the grid should be filtered and only products related to the selected treeItem OR one of it’s children shall be displayed. The grid’s filterEditor shall be used for further filter criteria (like manufacturer)
3 - If a product ListGrid record is selected, additional details are fetched (from a third DataSource) into another grid based on several criteria of the product record.
Comprehensive questions:
I have two issues here..
A - Is there a way to get the children of a TreeField record out of the box or do I have to make a callback to the server?
B - In step 3, the additional details need to be fetched server side as the results have to match two criteria. I can’t load the full set of data and filter client-side as a fetch without criteria would result in thousands of rows.
I’m using the GWT RPC DataSource and tried adding the two relevant criteria before calling fetchData(criteria). Within DataSource.executeFetch I retrieve the two criteria (criteria.getAttribute(…)) and set them as parameters to the rpc call. Although I get the required results in this scenario, using filterEditor doesn’t work anymore (filter actions result in the original ResultSet, not matich currently entered criteria).
I think I’m following the wrong approch and was hoping to get a better direction here.
Product Grid
addSelectionChangedHandler(new SelectionChangedHandler() {
@Override
public void onSelectionChanged(SelectionEvent event) {
ListGridRecord selectedRecord = getSelectedRecord();
if (selectedRecord != null) {
if (currentSelection == null) {
currentSelection = selectedRecord;
Product prod = new Product();
ProductDS.copyValues(selectedRecord, prod );
eventBus.fireEvent(new ShowDetailsEvent(prod, selectedRecord));
} else if (!currentSelection.equals(selectedRecord)) {
currentSelection = selectedRecord;
Product prod = new Product();
ProductDS.copyValues(selectedRecord, prod );
eventBus.fireEvent(new ShowDetailsEvent(prod, selectedRecord));
}
}
}
Details DS
@Override
protected void executeFetch(final String requestId, final DSRequest request, final DSResponse response) {
Criteria criteria = request.getCriteria();
Integer productID= Integer.parseInt(criteria.getAttribute("productID"));
Integer tabIdx = Integer.parseInt(criteria.getAttribute("seID"));
rpcService.fetchDetails(productID, tabIdx, new AsyncCallback<List<Scan>>() {
...
}
}