EasyUI Forum
April 29, 2024, 08:34:34 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 editor within datagrid  (Read 9489 times)
jaimi
Full Member
***
Posts: 119


View Profile
« on: January 29, 2015, 05:15:51 AM »

Hi, at specific circumstances I want to deactivate the editor of the field.
How to?
THX,Jaimi

My datagrid:

$('#edgNews').edatagrid({
  title : 'Neuigkeiten',
  iconCls:'icon-Pferd',
  width:'100%', 
  height:'auto',
  collapsible : 'true',

  columns:[[ 
    {field:'OLT30A001T_KEY',title:'PferdKey',width:080,sortable:'true',hidden:'true'}
   ,{field:'OLT30A003T_KEY',title:'NewsKey',width:080,sortable:'true',hidden:'true'}
   ,{field   :'NWS_STATUS'
      ,title   :'Status'
      ,width   :060
      ,sortable:'true'
     , align: 'center'
      ,editor  : {
        type   :'combobox'
      ,options:{
         valueField:'KEY'
        ,textField:'NWS_STATUS'
       ,url:'pferd.lkp.nws.json'
       ,required:true
       ,editable:true
       ,prompt:'Status...'
       ,missingMessage: 'Wählen Sie den Status aus.'
      }
     }//editor
    ,formatter:function(value,row){return value;}//formatter
   }         
   
   ,{field :'NWS_VIDEO',title:'Video',width:75,sortable:'true',hidden:'true'
     ,editor: {type:'textbox', options:{required:false}}
    }
....
Logged
eagleeye
Newbie
*
Posts: 19


View Profile Email
« Reply #1 on: January 29, 2015, 07:11:50 AM »

Use this code

Code:
$('#dg').datagrid({
    onBeforeEdit: function(index,row){
        var col = $(this).datagrid('getColumnOption', 'columnName'); // Here your column name
        if (some condition){
            col.editor = 'text';
        } else {
            col.editor = null;
        }
    }
})
Logged
gongjw123
Newbie
*
Posts: 7


View Profile
« Reply #2 on: January 29, 2015, 11:43:40 PM »

Code:
$('#dg').datagrid({
    onDblClickRow: function(index,row){
    var edType =$(this).datagrid('getEditor',{index:index,field:[font=Verdana]your field[/font]});   
    if([font=Verdana]your condition[/font]){
        $(edType.target).combobox('disable');
    }
})
Logged
jaimi
Full Member
***
Posts: 119


View Profile
« Reply #3 on: February 10, 2015, 09:57:08 PM »

thx to all. Jaimi
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!