EasyUI Forum
April 29, 2024, 09:48:04 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: edatagrid: problem to format a checkbox in edatagrid editor mode  (Read 9516 times)
centurion.cl
Newbie
*
Posts: 3


View Profile Email
« on: May 07, 2014, 07:40:24 AM »

I have a problem to format a checkbox in edatagrid editor mode:

How I can disable a checkbox in edatagrid editor mode when I have other column value > 0

      {field:'actives',title:'Actives',width:40,align:'center',
     formatter:function(value){
                if (value == 0){
                   return '<span style="color:red;">'+value+'</span>';
                } else {
                    return value;
                }
          },
      {field:'inactives',title:'Inactives',width:80,align:'center',
            formatter:function(value){
                if (value == 0){
                   return '<span style="color:red;">'+value+'</span>';
                } else {
                    return value;
                }
                  }
          },
    {field:'state',title:'Status',width:50,align:'center',
           editor:{type: 'checkbox',
                   options:{on:'S',off:'N', formatter:function(value,row,index){

                   /*** instruction problem *****/
                    if (row.actives > 0)
                        checkbox disabled
                   }

                  }
           },    
           formatter:function(value,row,index){
             if (value == "N")
                  return '<span style="color:red;">'+value+'</span>';
             else            
                  return value;            
           }
       }



« Last Edit: May 07, 2014, 08:22:55 AM by centurion.cl » Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: May 07, 2014, 05:16:32 PM »

Please try this:
Code:
$('#tt').edatagrid({
onEdit: function(index,row){
if (some conditions){
var ed = $(this).datagrid('getEditor',{index:index,field:'state'});
$(ed.target).attr('disabled','disabled');  // disable the editing on state column
}
}
});
Logged
centurion.cl
Newbie
*
Posts: 3


View Profile Email
« Reply #2 on: May 08, 2014, 06:18:46 AM »

thank you ....thank you, .....thank you, It works !!!!!!  wiiiiiiiiiiii
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!