EasyUI Forum
October 20, 2025, 02:42:44 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: i need a customized checkbox editor in editable datagrid, but don't know how.  (Read 8409 times)
Jeffrey AnnSheila
Newbie
*
Posts: 21


View Profile Email
« on: May 24, 2016, 02:21:51 AM »

hi,i want to make a field to be a checkbox editor in an editable DataGrid . the underline data  stored in mysql is 1 or 0,and  i need the checkbox text show "yes" when the value is 1 and "no" when the value is 0. When i check "yes" the value should be 1 and send to mysql, check "no" will send value 0 too.
The demo is editor:{type:'checkbox',options:{on:"yes",off:"no"}}, but it doesn't work here. please help me resolve it.thanks.
Logged
jarry
Administrator
Hero Member
*****
Posts: 2300


View Profile Email
« Reply #1 on: May 24, 2016, 08:26:22 AM »

Please try this code:
Code:
<th data-options="
        field:'status',
        width:60,
        align:'center',
        formatter:function(value){
            return value==1 ? 'yes' : 'no';
        },
        editor:{type:'checkbox',options:{on:'1',off:'0'}}
        ">Status</th>
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!