EasyUI Forum
April 28, 2024, 07:58:42 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: How to change the edit property of the Cell Editing in DataGrid.  (Read 6951 times)
dustinjo
Newbie
*
Posts: 3


View Profile
« on: January 26, 2017, 07:12:23 PM »

Hi, I am trying to change the edit property of the Cell in the DataGrid for primary key column.
I want to disable the edit if the row exists, but the new row needs to be editable for the key column.

Please give an advice how to change the cell property in the DataGrid.
Thank you.
Logged
jarry
Administrator
Hero Member
*****
Posts: 2262


View Profile Email
« Reply #1 on: January 26, 2017, 09:04:44 PM »

You can modify the 'editor' property of the specified column before editing a row. Please look at the code below:
Code:
$('#dg').datagrid({
  onBeforeEdit: function(index,row){
    var col = $(this).datagrid('getColumnOption', 'field1');
    if (somecondition){
      col.editor = {
        type:'textbox',
        options:{
          //...
        }
      }
    } else {
      col.editor = null;
    }
  }
})
Logged
dustinjo
Newbie
*
Posts: 3


View Profile
« Reply #2 on: January 27, 2017, 05:58:58 PM »

Thank you for your help.
It is working.
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!