7 Nov 2011 1:48 AM #1
Best way to auto load more data into a grid
I have been playing with the idea to get data auto loaded into a grid when the user scrolls towards the bottom. I added a listener for scrollevents on the grid and could load more data into it, but:
1) I cannot append data to the grid, only load data again with N more rows. Is there a append feature i have not seen?
2) When the data is loaded, it auto-scrolls back to the top, which again triggers the scroll-event. How can i keep the user at the location he/she was at? It feels a bit hacky to save location before loading more data and it wont work well since a mouse scroll will trigger the listener many times before new data is loaded.
Is there something better to use, perhaps liveGrid?
7 Nov 2011 9:16 AM #2
- Join Date
- Mar 2007
- Gainesville, FL
- Vote Rating
I don't have docs for Ext JS 2 but in Ext JS 3, in the load method you can pass a config object and one of the configs is 'add' which if set to true it will append the data instead of replacing the current dataset.Mitchell Simoens @LikelyMitch
Sencha Inc, Senior Software Engineer
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services firstname.lastname@example.org
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!
When posting code, please use BBCode's CODE tags.
7 Nov 2011 10:22 AM #3
Thanks for the suggestion!
I did a test with LiveGrid and it works just as i want to, and it gives me the wanted features without giving the issue with the browser jumping back to the top of the grid.