EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: morib on May 06, 2014, 01:05:30 PM



Title: How to display a true / false value in a datagrid as a checkbox
Post by: morib on May 06, 2014, 01:05:30 PM
I am using the datagrid without any editor feature.  One of the columns contains a boolean value (true or false).  The users want the grid to show a static checked checkbox when the value is true and a static unchecked checkbox otherwise. Is this feasible?

Thanks!


Title: Re: How to display a true / false value in a datagrid as a checkbox
Post by: morib on May 06, 2014, 01:21:34 PM
I found a way to do this.  I use a formater function on the boolean column as shown below.

                 formatter: function (value) {
                     if (value == 'True') {
                         return '<input type="checkbox" checked>';
                     }
                     else {
                         return '<input type="checkbox" >';
                     }


Title: Re: How to display a true / false value in a datagrid as a checkbox
Post by: arma on May 06, 2014, 07:25:49 PM
Instead of using checkbox for display purpose you could use this char '√' :)


Title: Re: How to display a true / false value in a datagrid as a checkbox
Post by: morib on May 09, 2014, 07:59:45 AM
Good idea, thanks !