Hy there,
I have a very basic example with a grid with only 1 item and a button which updates this entry with the set-method of the underlying record.
The problem is, that if the item is selected at the time the record gets updated by pressing the button, the selection gets removed and it’s not possible to select it anymore afterwards.
Working example: http://jsfiddle.net/fu2Xq/2/
Ext.onReady(function() { var personsGrid = Ext.create('Ext.grid.Panel', { width: 150, height: 100, renderTo: Ext.getBody(), store: Ext.create('Ext.data.Store', { fields: [ 'name' ], data: [{ name: 'Stephen' }] }), columns: [{ text: 'Name', dataIndex: 'name', flex: 1 }], }); var txtField = Ext.create('Ext.form.field.Text', { fieldLabel: 'New name', labelWidth: 70, width: 150, value: 'Alex', renderTo: Ext.getBody() }); Ext.create('Ext.button.Button', { text: 'Rename person', width: 150, renderTo: Ext.getBody(), handler: function() { var rec = personsGrid.getStore().getAt(0); rec.set('name', txtField.getValue()); } }); });
Seems like a bug to me because after reordering the name-column the selection reappears…
I’d really appreciate some comment on this!
Thanks
edit: reformated some code…
It’s a bug in ExtJS 4.1.1 which seems to be solved in 4.1.3 and can be worked around by calling the refresh-method of the grid’s view after updating the record:
http://jsfiddle.net/fu2Xq/7/
I got this answer from the Sencha forum:
http://www.sencha.com/forum/showthread.php?253287-Item-in-grid-is-deselected-after-record-has-been-modified-with-set-method&p=928197&viewfull=1#post928197