PDA

View Full Version : Solved: Unable to utilise rowselect from selection model in Editor Grid



sleepyuk
27 Apr 2010, 3:33 AM
Hi Folks,

I'm in my first week of extjs and I am massivly impressed. Indeed it's the first thing that has made me acutally use JS so I'm sure that this issue is my own lack of js knowledge however any assistance would be very welcome.

I have a window which contains a grid. 1 of the grid columns is editable. However I would like the start edit to occur when the row is selected rather than on click - to allow keyboard navigation of the grid. The grid will only ever contain <20 rows and it's likely that a value would need to be entered for all 20.

Based on a method I used on another grid which works perfectly, I decided to use the rowselect event of the grid selection model. As far as I can tell my code is the same as the working example, however the function set to handle it is never fired (confirmed with a firebug console log statement, that doesn't appear).


var

newOrderWindow = new MyWindowUi();


var



tSM = Ext.getCmp('newOrderAccountGrid').getSelectionModel();


tSM.on('rowselect',

function (selectionModel, rowIndex, selectedRecord)

{
console.log("edit row function called");
newOrderAccountGrid = Ext.getCmp('newOrderAccountGrid');
newOrderAccountGrid.startEditing(rowIndex, 1);
}
);






newOrderWindow.show();


When this is run, the window shows. tSM is a selection model and not null and 'newOrderAccountGrid' is the appropriate and unqiuely named grid.


However my console log statement does not appear on selection of a row.


Any suggestions?


Many thanks,
Sleepy

sleepyuk
27 Apr 2010, 4:31 AM
Solved by creating the selection model ahead of time. Same code. Unsure why this matters, but it worked.