Hi,
I'm trying to pass a DSCallback to ListGrid.fetchData(Criteria criteria, DSCallback dsCallBack) because I need to run some custom code based on the server response (specifically, the data I'm passing as search criteria can fail special server-side validation logic and I need to flag errors in the search form accordingly).
Anyway, long story short: the validation is working, and so is the actual fetch and the DSCallback(). But the problem is that I don't know how to communicate to the ListGrid the total size of the result set on the server side (the ListGrid is using paging). My server side data object is correctly returning the data the listGrid needs (i.e. startRow, endRow, totalRows, etc) and it works fine when I don't pass the DSCallback to the fetchData() method. However, the code for my DSCallback is as follows:
If the resultset on the serverside is greater than 75, I end up having problems. Let's say for instance there are 400 results. The ListGrid asks for result 0-75. My server-side DAO correctly retrieves result 0-75 and sets totaRows to 400. However, because in the callback I'm simply passing the data as a recordList, the ListGrid just sees a list with 75 items and renders that - it doesn't try to page any further (because it doesn't know there are actually 400 total results).
So I'm not sure what to put in the DSCallback to tell the ListGrid what the real resultset size is. I've tried playing around with com.smartgwt.client.data.ResultSet, specifically changing the DSCallback to:
On the one hand, this works because the ListGrid now correctly realizes that there are 400 total results and starts paging. But on the other hand, it appears some really crucial information is now missing from the ResulSet object and the ListGrid starts throwing some really nasty javascript errors in the process.
Anyway, that's probably not the right approach, but I'm not sure what is.
Thanks.
I'm trying to pass a DSCallback to ListGrid.fetchData(Criteria criteria, DSCallback dsCallBack) because I need to run some custom code based on the server response (specifically, the data I'm passing as search criteria can fail special server-side validation logic and I need to flag errors in the search form accordingly).
Anyway, long story short: the validation is working, and so is the actual fetch and the DSCallback(). But the problem is that I don't know how to communicate to the ListGrid the total size of the result set on the server side (the ListGrid is using paging). My server side data object is correctly returning the data the listGrid needs (i.e. startRow, endRow, totalRows, etc) and it works fine when I don't pass the DSCallback to the fetchData() method. However, the code for my DSCallback is as follows:
Code:
private class DIDSearchCallback implements DSCallback { @Override public void execute(DSResponse response, Object rawData, DSRequest request) { if(response.getStatus() == DSResponse.STATUS_VALIDATION_ERROR) { if(response.getErrors().size()!=0) { vm.setErrors(response.getErrors(), true); } } else { results.setData(response.getDataAsRecordList()); } } }
So I'm not sure what to put in the DSCallback to tell the ListGrid what the real resultset size is. I've tried playing around with com.smartgwt.client.data.ResultSet, specifically changing the DSCallback to:
Code:
private class DIDSearchCallback implements DSCallback { @Override public void execute(DSResponse response, Object rawData, DSRequest request) { if(response.getStatus() == DSResponse.STATUS_VALIDATION_ERROR) { if(response.getErrors().size()!=0) { vm.setErrors(response.getErrors(), true); } } else { ResultSet resultSetProperties = new ResultSet(); resultSetProperties.setLength(response.getTotalRows()); results.setDataProperties(resultSetProperties); results.setData(response.getDataAsRecordList()); } } }
Anyway, that's probably not the right approach, but I'm not sure what is.
Thanks.
Comment