PDA

View Full Version : RowEditing how to enabled via record settings.



Anthony.Hall
4 Sep 2012, 3:18 AM
I have the following grid with rowEditing. I'd like to be able to enabled/disable the edit depending on a value on the record. How can i call the dblClick Event



var processRowEditing = Ext.create('Ext.grid.plugin.RowEditing', { clicksToMoveEditor: 1,
autoCancel: false
});


Ext.define('Mis.view.ProcessList', {
extend:'Ext.panel.Panel',
alias:'widget.processlist',
layout: {
align: 'stretch',
type: 'fit'
},
items:[
{
xtype:'gridpanel',
title:'Processes',
store:'Processs',
id:'processGrid',
plugins: [processRowEditing],
layout: {
align: 'stretch',
type: 'fit'
},
height:250,
border:0,
{
xtype: 'pagingtoolbar',
store:'Processs',
dock: 'bottom',
displayInfo: true,
displayMsg:'Displaying records {0} - {1} of {2}  ',
emptyMsg:"No records to display ",
flex:1
}
],
columns:[
{
xtype:'gridcolumn',
dataIndex:'Seq',
text:'Seq',
flex:1,
align:'center'
},
{
xtype:'gridcolumn',
dataIndex:'ProcessTypeName',
text:'Type',
flex:1,
align:'center'
},
{
xtype:'gridcolumn',
dataIndex:'PartName',
text:'Part',
width:150,
align:'center'
},
{
xtype:'gridcolumn',
dataIndex:'Quantity',
text:'Quantity',
flex:1,
align: 'center',
editor: {


}
},
{
xtype:'gridcolumn',
dataIndex:'Overs',
text:'Overs',
flex:1,
align: 'center',
editor: {


}
},
{
xtype:'gridcolumn',
dataIndex:'Created',
text:'Created',
flex:1
},
{
xtype:'gridcolumn',
dataIndex:'Name',
text:'Notes',
width: 370,
editor: {


}
}
]
}
],
initComponent:function () {
this.callParent();
}
});

Farish
4 Sep 2012, 3:26 AM
you can access the record in the beforeedit event of rowediting plugin and get the value of a particular field using get method. comparing this value, you can return false to cancel editing.


rowEditing.on('beforeedit', function(editor, e, eOpts) {
console.log(editor.record);
if(editor.record.get('field') == value)
return false;
});