When trying to get the selected row, the following error appears:
Uncaught TypeError: Object
How to get the currently selected row when I cannot get a view and therefore SelectionModel?
My view code:
Ext.define('MyLodge.view.content.MemberGrid', { extend: 'Ext.grid.Panel', alias: 'widget.membergrid', initComponent: function(){ var rowEditing = Ext.create('Ext.grid.plugin.RowEditing'); var store = Ext.create('MyLodge.store.Members'); Ext.apply(this, { height: this.height, plugins: [rowEditing], store: store, stripeRows: true, columnLines: true, columns: [{ id :'id', text: 'ID', width: 40, sortable: true, dataIndex: 'id' },{ text : 'Name', flex: 1, sortable : true, dataIndex: 'name', field: { xtype: 'textfield' } },{ text : 'E-Mail', width : 150, sortable : true, dataIndex: 'email', field: { xtype: 'textfield' } },{ text : 'Href', width : 200, editable: false, sortable : true, dataIndex: 'href' }], dockedItems: [{ xtype: 'toolbar', items: [{ text: 'Add', iconCls: 'icon-add', handler: function(){ // empty record store.insert(0, new MyLodge.model.Member()); rowEditing.startEdit(0, 0); } }, { text: 'Delete', iconCls: 'icon-delete', handler: function(){ var selection = grid.getView().getSelectionModel().getSelection()[0]; if (selection) { store.remove(selection); } } },'-',{ text: 'Save', iconCls: 'icon-save', handler: function(){ store.sync({ success: function(response){ store.load() } }); } },{ text: 'Refresh', handler: function(){ store.load(); } }] }] }); this.callParent(arguments); } });