GXT pagination without RPC proxy
Any idea how I can implement proper pagination without a RPCProxy in GXT? I am currently setting the loader like this:
final PagingLoader<PagingLoadResult<ModelData>> loader = new BasePagingLoader<PagingLoadResult<ModelData>>(null);
store = new ListStore<T>(loader);
And then pass the store to the grid constructor.
Now, if I set null
instead of a proxy in the constructor, my pagingToolbar just freezes and goes disabled and displays what appears to be a loading circle.
I read the ideas in here http://www.sencha.com/forum/showthread.php?61780-Pagination-wit开发者_Go百科hout-RPC, but can anyone be a bit more explicit on how to achieve this?
I am creating the grid and then adding the data and I'm working with RequestFactory so no RCPProxy needed.
You can just implement the DataProxy interface and use your custom data-obtaining method:
BasePagingLoader<PagingLoadResult<ModelData>> loader = new BasePagingLoader<PagingLoadResult<ModelData>>(new DataProxy<PagingLoadResult<ModelData>>() {
@Override
public void load(DataReader<PagingLoadResult<ModelData>> reader,
Object loadConfigAsObject, AsyncCallback<PagingLoadResult<ModelData>> callback) {
BasePagingLoadConfig loadConfig = (BasePagingLoadConfig) loadConfigAsObject;
// Get the results for the requested page...
BasePagingLoadResult<ModelData> pagingLoadResult = new BasePagingLoadResult<ModelData>(...);
callback.onSuccess(pagingLoadResult);
}
});
精彩评论