PDA

View Full Version : Display selected row in the middle of Grid Panel



arnoldvillasanta
12 Jul 2014, 3:55 AM
In ExtJS 4.2.x... when programatically setting the selectionModel of a grid panel as below:



if (combo) {
var listGrid = Ext.getCmp("MaintenanceCustomerListPanel").down("#CompanyListGrid");
var listRecord = listGrid.getStore().find('companyID', combo.getValue());
if(listRecord){
listGrid.getSelectionModel().select(listRecord);
//listGrid.getView().focusRow(listRecord);
//Ext.fly(listGrid.getView().getNode(listRecord)).scrollIntoView();

}
}


... is there a way to display the selected (focused) row somewhere in the middle of the grid panel?

It's becoming counter-intuitive to see the selected row either on the top or at the bottom of the grid panel... (depending on where the previously selected and the current selected rows are).

This is coming from a usability requirement. :)

skirtle
12 Jul 2014, 11:33 AM
A bit like this?

7l9

Select a row then click the button to scroll the selected row to the middle.

arnoldvillasanta
12 Jul 2014, 7:57 PM
I hope this kind of usability enhancement will be part of the core Extjs 4.2.x someday.
Thanks Skirtle for the help.