PDA

View Full Version : Interaction between row editor and renderer in grid ?



roffer
20 Oct 2014, 7:44 PM
I have a store that stores its values in bytes, I want the grid editor to display the column in MB.

So I added a renderer function to the column.

However when I enabled row editing the value that is saved to the store is MB (which the renderer function then processes into a very small number)


Is there a way to write the bytes value to the underlying store, while still preserving the MB value in the display ?



...
}, {
header: 'Minimum (MB/s)',
sortable: true,
dataIndex: 'minimum',
xtype: 'numbercolumn',
editor : {
xtype: 'numberfield'
},
renderer : function ( value, metadata, record ) {


var MBs = parseInt( value );


return MBs / ( 1024 * 1024 );

}
}, {
...

slemmon
22 Oct 2014, 8:31 PM
You might try evaluating the edited value in an edit listener on the cell/row editor and change the underlying value as necessary to store the value modified from the raw value input into the editor:
http://docs.sencha.com/extjs/4.2.3/#!/api/Ext.grid.plugin.CellEditing-event-edit