View Full Version : grid onload not retaining selection

Pankaj Kumar M
29 Mar 2016, 2:46 AM
I'm need to select 3 rows (i.e. row num: 2, 5,7) in the grid in one page .

i) Here in the below code i'm able to select only the 7th row, other 2 rows are not getting selected.
ii) 7th row is getting selecting only when navigating to next page. Initially when the grid loads it is not selecting.

grid.store.on("load", function(){

grid = ColdFusion.Grid.getGridObject("grid");
var model = grid.getSelectionModel();

29 Mar 2016, 6:10 PM
Looks like you are posting in the wrong forum
There is no selectRow function in selectionModel of a grid in ExtJS 4.x

This is probably what you are looking for:


If you are using extJS 3.x use selectRows with keepexisting as true :


Pankaj Kumar M
30 Mar 2016, 7:21 AM
The code is below, i'm calling this function pagingFn on ajaxOnLoad on of cfgrid.

The code you posted is in bold. It is not firing.

grid = ColdFusion.Grid.getGridObject("gridname");

var data = grid.getStore();
var model = grid.getSelectionModel();


//overwrite existing grid footer with new div, Ext.id() will assign unique id to footer
var bbar = Ext.DomHelper.overwrite(grid.bbar,{tag:'div',id:Ext.id()},true);
//Create new PaginToolbar and render it to bbar (grid footer)
gbbar = new Ext.PagingToolbar({renderTo:bbar,
store: grid.store,
pageSize: 10,
displayInfo: true,
displayMsg: '<b>Showing {0} - {1} out of {2} Transactions</b>',
emptyMsg: "<b>No Record</b>",
moveNext : function(){

grid = ColdFusion.Grid.getGridObject("gridName");
var sm = grid.getSelectionModel();
sm.select(selections, true,false);

'-', {
pressed: false,
tooltip:'Click here',
text: 'View All',// The text that will show for the button in the bar
icon:'css/add.png',//Icon graphic
cls: 'x-btn-text-icon',//The ext class that will display the button with text/icon properly
handler:showGridAll// handler:showGridAll // should be replaced with your own function


30 Mar 2016, 7:23 AM
What is the "grid" object? Is it an ExtJS grid? If not then obviously it won't fire :)