PDA

View Full Version : Controlling the scroll bar when loading additional Grid items



plightbo
21 Feb 2008, 9:11 PM
I figured out that GridPanel.loadRecords can take an option "add" that will tell the grid to _add_ loaded items from the store to the table rather than replace them. This isn't documented as far as I can tell, but it mostly does what I want, which is to dynamically grow the list as the user scrolls down and gets closer to the bottom of the list.

My problem is that the grid panel puts the focus and scroll bar back at the _top_ of the list, which is not what I want. Does anyone know any way to somehow tell the grid panel to append items to the total list but not affect the scroll position in any way? Even better would be if I could eliminate the load mask or do some other sort of indicator that merely showed that more items were being loaded (rather than implying the whole list was being loaded).

Thoughts?

Patrick

Condor
21 Feb 2008, 11:00 PM
The store will fire a load event if you call loadData.

To avoid this you could use:


var r = store.reader.readRecords(data);
store.totalLength = Math.max(r.totalRecords || r.records.length, store.data.length + r.records.length);
store.add(r.records);

ps. Doesn't LiveGrid (http://www.siteartwork.de/livegrid/) already do what you want?

plightbo
22 Feb 2008, 6:20 AM
Got it. Didn't even know about the LiveGrid stuff... seems there are a lot of extensions not listed at http://extjs.com/learn/Ext_Extensions that I'm missing! Any plans to help make that "database" more current?