PDA

View Full Version : Scroll to record in buffered grid in 4.1?



Teemac
25 May 2012, 7:47 AM
So I'm trying to scroll to a record that is outside my visible view in a buffered grid. I'm attempting to use setScrollTop but it doesn't appear to do anything other then set a property but the grid is never actually scrolled, is there another way to do it or is there a bug? If I'm correct in thinking that setScrollTop should actually scroll the scrollbar an easy example of it failing is adding the following dockedItems to the buffered grid example from the docs and click the button in theory it should scroll down a bit in the grid.


dockedItems: [{xtype: 'button', text: 'scroll test', handler: function (button) {button.up('grid').setScrollTop(600)}}],

redraid
25 May 2012, 8:15 AM
Try http://docs.sencha.com/ext-js/4-1/#!/api/Ext.grid.View-method-focusRow method


grid.view.focusRow(record);

Teemac
25 May 2012, 8:23 AM
Yea that works when the record you want is in the view but when it's outside the view it doesn't find it. So the example would be prefetching all data on a grid with 1000 records and trying to select the last item, unfortunately the view only has the first 200 so it doesn't find the node.