EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: retroip on October 21, 2013, 12:40:55 PM



Title: [SOLVED] DataGrid - Set cell denied from editing
Post by: retroip on October 21, 2013, 12:40:55 PM
Hello there,
I'v browsed/searched for this topic, no results, for me it seems a little bit special.

Case:
I have datagrid with editable Rows (row.editing = true;). 3 columns are editable (from more) after switching into edit row mode (they have defined editors: datebox,text,datebox)

My target:
I want to prevent 1st two editable columns from editing, and keep just 1 (3rd) editable column because of one condition in row. When condition changes to another value, I want to edit 1st two editable columns and prevent 3rd column from editing.

Is this possible to achieve dynamic editmode for columns  ?

My work:
var ed = $('#xxx').datagrid('getEditor', {index:index,field:'yy'});
$(ed.target).datebox({disabled:true});

ED variable is empty

CellEditing is alternative, but I cannot achieve my target anyway.

EasyUI ver. 1.3.2, JQ 1.8.0

Thank you for your suggestions


Title: Re: DataGrid - Set cell denied from editing
Post by: kandy on December 05, 2013, 06:34:54 AM
Do you have found some solutions? I would like to have the conditional editing me too.


Title: Re: DataGrid - Set cell denied from editing
Post by: stworthy on December 05, 2013, 07:28:49 AM
To enable the editing feature on some specified columns, set 'editor' property for these columns. Remove 'editor' property will disable the editing functionality.
Code:
var col = $('#dg').datagrid('getColumnOption', filename);
col.editor = {
  type:'datebox',
  options:{
    required:true
  }
};
$('#dg').datagrid('beginEdit', index);

Running the code below can't edit the specified column since its 'editor' property is null.
Code:
var col = $('#dg').datagrid('getColumnOption', filename);
col.editor = null;
$('#dg').datagrid('beginEdit', index);


Title: Re: DataGrid - Set cell denied from editing
Post by: retroip on January 04, 2014, 08:15:44 AM
Works like a charm !

Thank you very much