PDA

View Full Version : How to avoid the dirty marker in EditorGridPanel



dev_java
13 Sep 2010, 11:06 PM
Hi,
I have an EditorGridPanel, with few columns and a combo box. On Selection of combo box, few data in the particular row will get updated. this is working fine. But when the cells are updated, its marked as dirty. I dont want to show this dirty marker in any of the updated cells. How to avoid the dirty marker for this grid?


Thanks

attu
13 Sep 2010, 11:26 PM
Are you using the correct xtype in the editor properties of the columns? Can you put some code and example of usage?

Condor
14 Sep 2010, 12:05 AM
commit() the record after updating the fields.

dev_java
14 Sep 2010, 2:50 AM
Hi,

i gave commit() in the afteredit event of grid. but it dint work.

here is my code



alarmStore = new Ext.data.Store({
proxy: new Ext.data.HttpProxy(
new Ext.data.Connection({
url:'../demo/showAlarm.htm'
})
),
reader:new Ext.data.JsonReader({
totalProperty:'almSize',
root:'almList',
fields: [
'id',
'type',
'value',
'severity',
'enable',
'mode'
]
})
});
alarmStore.setDefaultSort('value', 'asc');
var mapCombo = new Ext.form.ComboBox({
typeAhead: true,
triggerAction: 'all',
lazyRender: true,
mode:'local',
store:mappedStore,
valueField: 'Id',
displayField: 'Text'

});

var enableCombo = new Ext.form.ComboBox({
typeAhead: true,
triggerAction: 'all',
lazyRender: true,
mode:'local',
store:enableStore,
valueField: 'enableId',
displayField: 'enableText',

});
var alarmGrid = Ext.extend(Ext.grid.EditorGridPanel, {
initComponent:function() {
var config = {
store: alarmStore,
columns: [

{header: "ID", width:100, dataIndex: 'id'},
{header: "Type",width:125, dataIndex: 'type'},
{header: "Value",width:125, dataIndex: 'value'},
{header: "Severity",width: 175, dataIndex: 'severity',
editor: mappedCombo,
renderer: Ext.util.Format.comboRenderer(mapCombo)

},
{header: "Image",width:20, dataIndex: 'severity',renderer:change}
{header: "Enable",width: 100, dataIndex: 'enable',
editor: enableCombo,
renderer: Ext.util.Format.comboRenderer(enableCombo)
},

],
enableColumnMove: false,
selModel: rowhandler,
loadMask:{
msg:'Loading...'
}

};
Ext.apply(this, Ext.apply(this.initialConfig, config));
alarmGrid.superclass.initComponent.apply(this, arguments);
}
,onRender:function() {
alarmGrid.superclass.onRender.apply(this, arguments);
alarmStore.load(
// callback: function(r,options,success) {
// });
// }
);
}
});

Ext.reg('alarmGrid', alarmGrid);

Ext.getCmp('alarmGrid').on({
afteredit:{
fn: function(grid, rowIndex, columnIndex, e){
alarmMappingStore.commit();

}
}
});
function change(value){
if(value=='CR')
return '<div class="critical">&#160;</div>'
else if(value=='MJ')
return '<div class="major">&#160;</div>'
else if(value=='MN')
return '<div class="minor">&#160;</div>'
else if(value=='NA')
return '<div class="NA">&#160;</div>'
}



Here on change of mapCombo , Image column will be updated with corresponding image based on severity. These two cells are marked with dirty that time.. I want to avoid this.

Thanks

Condor
14 Sep 2010, 3:34 AM
See the Grid FAQ (http://www.sencha.com/learn/Ext_FAQ_Grid#Dirty_Record_.2F_Red_Flag_.28modifying.2C_etc..29).

dev_java
14 Sep 2010, 3:38 AM
I gave after edit event wrongly. Thanks Condor