I am trying to select the first row in a grid:
Ext.getCmp('myGrid').getSelectionModel.select(0);
I got an error saying select is undefined
but I can see the function exists.
I was using the ExtJS 4.2 version and I had no problem with that, now I am using the 6.5 version and I got that error.
What could be the problem here?
--EDIT--
Basically I have a function to create the store:
CreateDataStore: function (result, id) {
Ext.define('DDM', {
extend: 'Ext.data.Model',
fields: result.FieldColumns
});
var dataRecords = JSON.parse(result.Records);
return Ext.create('Ext.data.Store', {
id: id,
autoLoad: true,
model: 'DDM',
data: dataRecords,
remoteSort: false,
fields: result.Fields
});
}
And another function to assign the store to the grid and select the first row:
function BindDataGrid(result) {
gridStore = CreateDataStore(result, 'myGridStore');
Ext.getCmp('myGrid').reconfigure(gridStore);
if (Ext.getCmp('myGrid').getStore().getCount() > 0)
Ext.getCmp('myGrid').getSelectionModel().select(0);
}