I have a save button
which I wanted to enable only when grid is dirty. I mean If I modified any row value in grid I want to be enable. Currently My button is disable.
My Button code is.
{
xtype : 'button',
text : "Save",
disabled: true,
handler : function () {
//Code
}
}
I don't have an idea how to make that.
I don't think that grid dirty
is any property. You soluntion is something like this. Since you are using ExtJS 3 then You need to use id for button. and then take a store and check if any record is modified or not. if modified then make disabled false.
Sample code is :
First add id :
{
xtype : 'button',
text : "Save",
id : 'Save_Btn';
disabled: true,
handler : function () {
//Code
}
}
then use below code.
var SaveBtn = Ext.getCmp('Save_Btn');
var recordLength = gridStore.modified.length;
if(recordLength > 1)
SaveBtn.setDisabled(false);
or you can use by selection :
Code is
var record = grid.getSelectionModel().getSelections();
var SaveBtn = Ext.getCmp('Save_Btn');
if(record.length > 0)
SaveBtn.setDisabled(false);