EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: Jeffrey AnnSheila on May 24, 2016, 02:21:51 AM



Title: i need a customized checkbox editor in editable datagrid, but don't know how.
Post by: Jeffrey AnnSheila 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.


Title: Re: i need a customized checkbox editor in editable datagrid, but don't know how.
Post by: jarry 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>