EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: rezzonico on May 14, 2014, 12:13:56 AM



Title: Disable editing for a specifi column in edatagrid when modifying a row
Post by: rezzonico on May 14, 2014, 12:13:56 AM
Hi all,

I am using edatagrid.

When I add a new row all columns must be editable.
But when I modify a row, the first column (col1) must not be editable.

I have tryed to find a solution using the 'onClickRow' parameter but without success !
Can someone help me ?

Thank a lot
Miche


Title: Re: Disable editing for a specifi column in edatagrid when modifying a row
Post by: stworthy on May 14, 2014, 07:50:28 AM
To disable a editor on one column, you must empty the 'editor' property of specified column before editing a row. Please try to use 'onBeforeEdit' event.
Code:
$('#dg').edatagrid({
onBeforeEdit:function(index,row){
if (!row.isNewRecord){
var col = $(this).edatagrid('getColumnOption','itemid');
col.editor1 = col.editor;
col.editor = null;
}
},
onAfterEdit:function(){
var col = $(this).edatagrid('getColumnOption','itemid');
if (col.editor1){
col.editor = col.editor1;
}
},
onCancelEdit:function(){
var col = $(this).edatagrid('getColumnOption','itemid');
if (col.editor1){
col.editor = col.editor1;
}
}
});


Title: Re: Disable editing for a specifi column in edatagrid when modifying a row
Post by: rezzonico on May 15, 2014, 12:52:46 AM
Hi stworthy,

it works perfecly !

Thanks a lot.
Miche