ExtJS4 editable grid getting selected row returns empty
Trying to get the selected row index (and set another field value of the record afterwards) on a grid with CellEditing plugin, but getSelection() method returns an empty array. I have a listener for select event on the combobox, when that is changed I need to get the index of the edited row.
...
lazyRender: true,
listClass: 'x-combo-list-small',
listeners: {
scope: this,
select: function(field, value, options) {
var selection = Ext.getCmp('lineItemsGrid').ge开发者_C百科tSelectionModel().getSelection();
console.log(selection);
}
}
...
I'm using ExtJS 4.0.2a release. I'm a newbie when it comes to ExtJS, so I might be missing something.
Here is JSFiddle file in cas you want to have a look.
http://jsfiddle.net/Z6b7a/8/Any help is greatly appreciated.
Thanks
OzYou don't need to use the getSelection()
method, you can update the record directly from the edit event.
http://jsfiddle.net/Z6b7a/7/
I've updated the fiddle, and also here is the code to update the record after edit:
edit: function(editor, e, options) {
e.record.set('light', 'Shade');
//var selections = Ext.getCmp('lineItemsGrid').getSelectionModel().getSelection();
//console.log(selections);
}
精彩评论