PDA

View Full Version : How to scroll a grid to its bottom



jcagumbay
26 Apr 2010, 1:55 AM
I want to scroll down a grid to its last row loading data. I used mygrid.getView().focusRow(). It works but I wonder why it focus on the second to the last row and not on the last row which I wanted to be. I tried everything I see in web but none of those worked. Any help here? Thanks!

Below is part of my code, added a listener for the viewConfig:

viewConfig: {
listeners: {
refresh: function(view){
var rowCount = partid_temp_grid.getStore().getCount();
if (rowCount > 0) {
var a = function() { return view.focusRow(rowCount - 1);};
a.defer(500);
}
var b = function() { return Ext.getCmp('characterized_option_form-form-id').getForm().findField('part_id').focus()};
b.defer(550);
}
}
}

tobiu
26 Apr 2010, 5:51 AM
a quite simple idea: did you try


view.focusRow(rowCount);


instead of rowCount -1?


kind regards,
tobiu

jcagumbay
26 Apr 2010, 11:43 PM
I already tried that but it gives an error saying that "row is undefined". Anyway, thanks for the help.