1 Feb 2012 2:51 AM #11
1 Feb 2012 11:32 AM #12
Casting the loader as a PagingLoader seems to work. The one thing I'm missing how the server method for returning filtered, paged, and sorted results would look. Could you post a sample of the new getStocks method that works with the updated example?
12 Feb 2012 5:22 PM #13
- Join Date
- Feb 2009
- Vote Rating
The server code will probably be pretty specific to your particular backend - any kind of database probably provides features to filter or sort that would be much faster than implementing your own in your app server.
To send back the results, they should be packaged in a PagingLoadResult when they get to the loader so it can see how much data is left, and inform the store, toolbar. The sample code you posted seems to indicate that there is some DataProxy<FilterPagingLoadConfig, PagingLoadResult<KdoBaseDTO>> instance called 'service' that is actually being passed into your loader, but I don't see where that is defined, or how it is getting the data.
If using RPC, return an instance of PagingLoadResultBean<KdoBaseDOT>, having set the data, totallength, and offset, either in the constructor or with setters. If using RequestFactory, you'll need to indicate a specific class to return - RF has some issues with generic data (check out the examples sources at http://www.sencha.com/examples-dev/#...estfactorygrid). Using JSON or XML, you'll just create a PagingLoadResult instance from the data sent back from the server (there are no paging examples of this, but http://www.sencha.com/examples-dev/#...Place:jsongrid should give you the right idea).