EasyUI Forum
May 08, 2024, 12:49:51 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: [SOLVED] DataGrid - Set cell denied from editing  (Read 18934 times)
retroip
Newbie
*
Posts: 7


View Profile Email
« 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
« Last Edit: January 04, 2014, 08:21:45 AM by retroip » Logged
kandy
Newbie
*
Posts: 9


View Profile Email
« Reply #1 on: December 05, 2013, 06:34:54 AM »

Do you have found some solutions? I would like to have the conditional editing me too.
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #2 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);
Logged
retroip
Newbie
*
Posts: 7


View Profile Email
« Reply #3 on: January 04, 2014, 08:15:44 AM »

Works like a charm !

Thank you very much
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!