PDA

View Full Version : Scrolling to last row in Grid



davidsanderson
13 Jan 2010, 1:40 PM
I have found several topics on this but it's not working for me. On success of the AJAX insert call, then on load of the store, I am attempting to scroll to the last row. What am I doing wrong?



// insert Outline Item
Ext.Ajax.request({
url: 'lib/extdirect/courseEditor.cfc',
params : {
method : 'insertCourseOutlineItem',
CourseID : e.record.data.CourseID,
SortOrder : e.record.data.SortOrder,
OutlineItem : e.record.data.OutlineItem
},
success: function(response, opts) {

// reload the store to get the new CourseOutlineID
courseEditor.storeGetCourseOutline.load({
callback: function(record, options, success) {

// failed attempts on going to the last row!
var grid = courseEdtiro.gridCourseOutline;
grid.getView().getRow(grid.getStore().getCount() - 1).scrollIntoView();
grid.getView().focusRow(grid.getStore().getCount() - 1);

}
});

},
failure: function(response, opts) {
console.log('server-side failure with status code ' + response.status);
}
});

HeathT
22 Jun 2010, 11:57 AM
[gridObj].getView().focusRow([gridObj].getStore().getCount() - 1)

Hope this helps :D