Reputation: 1850
I'm following the example from the GXT website here: http://www.sencha.com/examples/#ExamplePlace:paginggrid
Their code creates an RPCProxy, overrides load() to make an RPC call to get data and then I assume the listStore is populated in the callback that isn't provided in the example.
Question: I want to populate the grid with search results so I want the fetching and loading of data to be done in response to sone button select event. I don't want to load the grid with data when it's created. I can't figure out how to refactor this example to do that.
Upvotes: 0
Views: 468
Reputation: 1109
I want to populate the grid with search results so I want the fetching and loading of data to be done in response
Just make sure you override the load method of RpcProxy class correctly, it will make an RPC call to your servlet and pass the search criteria, then receive the appropriate data.
I don't want to load the grid with data when it's created.
The RpcProxy object was passed to loader constructor, which mean the one controlling the RpcProxy object was the loader object. The grid by default was never loaded with data when it was created (unless we add the code to do that). The data was loaded everytime the method load of loader object was called, not when the object of loader or RpcProxy or even Grid object was created. Finally, here is some example code to search data using RpcProxy :
RpcProxy<PagingLoadConfig, PagingLoadResult<Post>> proxy = new RpcProxy<PagingLoadConfig, PagingLoadResult<Post>>() {
@Override
public void load(PagingLoadConfig loadConfig, AsyncCallback<PagingLoadResult<Post>> callback) {
service.getPostsBySearchCriteria(loadConfig, searchCriteria, callback); // make sure your rpc service receive search criteria parameter
}
};
Hope this could help you :-)
Upvotes: 1