PDA

View Full Version : [CLOSED] Grid load reset starting page



cwolcott
Oct 12, 2015, 8:09 PM
Let me see if I can describe this without an example.

I have a Grid, Store (PageSize=20) and PagingToolbar and I load the data based on a tree panel item. So based on the treenode it might show 120 items, but when I select a different tree node it will show 10.

I have never noticed this in my code until yesterday (I guess I didn't test very well). If I select the tree node with 120 items it says I am on page 1 of 6. I then go to page 2 and everything looks fine, but when I select the next tree node with only 10 items nothing shows in the grid and it states that I am on page 1 of 1. I assume the store thinks I am on page 2 since I use the e.Start and e.Limit in my query. If I press the refresh on the paging toolbar it refreshes the screen properly.

So I guess I need to determine a couple of things:

1) Should I always start back at Page 1 when I refresh a store.
2) If no items are returned and my e.Start doesn't equal 0, then reset e.Start and query again.

I think I like option 2 better. What are your thoughts?

cwolcott
Oct 13, 2015, 1:20 PM
I am working up a example right now. Extending the GridPanel --> Plugins --> GridFilters Remote

Daniil
Oct 13, 2015, 1:23 PM
Hi Chris,

In similar scenarios I am used to recommend the option #1. To me it is more intuitive for a user. If I click on a new node, I would expect to see the loaded data from the begging (i.e. the first page) disregarding what the page was for the previous node. Say, you are on the page #3, then click on another node and the current e.Start loads the page #4 or any other or even an empty page as in the case that you are considering. So, to me the option #2 is more intuitive. Also the option #2 means a possibility of an overhead request that I also don't quite like. One more thing that it will blink 0 it first loads an empty page, then it loads a not empty page. I don't think a user is going to like it.

Though, it is only my opinion. Maybe, in your case the option #2 is the best.

cwolcott
Oct 14, 2015, 2:16 AM
I found an thread that matches my issue exactly.

Remote-Paging-using-Store (http://forums.ext.net/showthread.php?45881-CLOSED-Remote-Paging-using-Store)

I have been able to duplicate it in an example and will try to apply it to my code tomorrow and let you know the status.

cwolcott
Oct 14, 2015, 12:37 PM
Please close the thread. I used loadPage(1) instead of load on the store to reset the page counter.