I'm trying to load an paginable grid using server response data. I posted a form through ajax and the server responded with the following JSON data. I'm trying to load the response data to the grid but records are added to the grid but the pagination component does not work. It just shows '0' of '0' page. Can someone help me out what am I doing wrong.

The first page in the paginable grid should not be loaded through store proxy. The first page in the grid is loaded through a POST request to the server, which sends a JSON response back to Ext JS. I'll need to load the store based on the server response. How to do that, I tried store.loadRawData(Ext.decode(response.responseText,true)) but it does not help.

Once the first page is loaded in the grid, then I will need to use the pagination toolbar component to navigate across pages.

scottmartin

21 Feb 2014, 8:24 AM

If you use loadRawData, then you are bypassing the proxy and paging configs. You would need to use load/loadPage()

I am not sure I understand your requirement for a special ajax call? The response should be handled automatically as my example shows, or do you have a special requirement based on the response?

arun_shank_r

21 Feb 2014, 8:43 AM

Scott,

To be more clear, there will be a form where user will enter search criteria values and do a JSON post. The server will process the post request and generate a JSON response.

This is the code which post the form data as JSON to the server. If you see here, I am sending the params required for pagination as query parameters in the POST request. When the server sends the response it sends the totalCount also (total number of resultsets) in addition to the 5 records as specified in the 'limit' parameter. I am loading the store using the response data. This would load the first page data in the gris. Let me know if there is a better way to handle this kind of requirement.

Have a look at load / loadPage that call loadToPrefetch() to use your paging information.
http://docs.sencha.com/extjs/4.2.2/source/Store.html#Ext-data-Store-method-load
http://docs.sencha.com/extjs/4.2.2/source/Store.html#Ext-data-Store-method-loadPage

bhaskarunichiranjeevi

4 Jan 2016, 1:53 AM

Did you get any solution for this. If yes kindly share it pls. Even I am trying the same from many days. In your case I know the problem.

I'm trying to load an paginable grid using server response data. I posted a form through ajax and the server responded with the following JSON data. I'm trying to load the response data to the grid but records are added to the grid but the pagination component does not work. It just shows '0' of '0' page. Can someone help me out what am I doing wrong.

This is great in theory but just doesn't work for me. Tried 50 times, there must be something you are leaving out in this example. All i get is a page with a paging toolbar but the columns are scrollable showing all rows.