EasyUI Forum
May 17, 2024, 05:59:31 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Disable editing for a specifi column in edatagrid when modifying a row  (Read 6030 times)
rezzonico
Full Member
***
Posts: 183


View Profile
« 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
« Last Edit: May 14, 2014, 12:17:37 AM by rezzonico » Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 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;
}
}
});
Logged
rezzonico
Full Member
***
Posts: 183


View Profile
« Reply #2 on: May 15, 2014, 12:52:46 AM »

Hi stworthy,

it works perfecly !

Thanks a lot.
Miche
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!