开发者

GXT pagination without RPC proxy

开发者 https://www.devze.com 2023-03-19 18:08 出处:网络
Any idea how I can implement proper pagination without a RPCProxy in GXT? I am currently setting the loader like this:

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);
        }
    });
0

精彩评论

暂无评论...
验证码 换一张
取 消