PDA

View Full Version : Event datachanged in editable grid



Eugent
25 Apr 2012, 2:59 AM
Hello, i have a question about editable grid.
There is an editable grid with toolbars, one of the buttons('Save'),which must respond to changes in the store - that is,when you add,change or delete a record, it must be activated.To add and edit event 'datachanged' is reacted, but on change data in grid - no reaction.


datachanged: function(th_store){
var grid = sys_cmn_cntrl.queryCmp('viewport index orderSysTabPanel orderSysGrid');
if(grid){
var button = grid.down('toolbar[name=control_tbar] button[action=save]');

if(button){
button.setDisabled(false);
}
}
}

scottmartin
25 Apr 2012, 9:59 AM
You should be able to place a listener on the store and detect changes:



var myStore = new Ext.data.Store({
proxy: myProxy,
autoLoad: false, // true
root: 'data',
idProperty: 'channel', // id
totalProperty: 'total',
successProperty: 'success',
fields: [ .. ],
listeners: {
beforeLoad: function(store, operation){ // 1st; no data items
//console.log('beforeLoad');
},
dataChanged: function(store){ // 2nd; data items populated, controls still empty
//console.log('dataChanged');
},
load: function(store, records, success){ // 3rd; data items populate, controls show data
//console.log('load');
}
}
});


Regards,
Scott.

Eugent
25 Apr 2012, 10:53 PM
Example at url http://extdev.eugent.org/testero/ .

item "Editable grid" button "Save" must be activated on change data in grid

vietits
25 Apr 2012, 11:17 PM
Ext.grid.plugin.CellEditing does not cause 'datachanged' event on store but instead it causes 'update' event. You can listen to this event to update the status of Save button.

Eugent
26 Apr 2012, 1:44 AM
Ext.grid.plugin.CellEditing does not cause 'datachanged' event on store but instead it causes 'update' event. You can listen to this event to update the status of Save button.

Yes, you right, thanks.