EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: WizPS on July 11, 2020, 02:25:04 PM



Title: Propertygrid formatter function as in Datagrid
Post by: WizPS on July 11, 2020, 02:25:04 PM
I use the formatter function in Datagrid to acomplish a visibility on NULL values like so and in the picture.

Code:
         toPush['formatter'] = function (value, row, index) {
         if (value === null) {
            return '<span style="background-color:rgba(255,255,0,0.2);">NULL</span>';
         } else {
            return value;
         }
      };

The row gets edited via a Propertygrid witch also inherits the formatter function from Datagrid. However NULL values are not any longer formatted by Propertygrid. How can I accomplish this formatting in Propertygrid?


Title: Re: Propertygrid formatter function as in Datagrid
Post by: jarry on July 11, 2020, 08:40:43 PM
Please define a 'formatter' function on the propertygrid column.
Code:
$('#pg').propertygrid({
columns: [[
{field:'name',title:'MyName',width:100,sortable:true},
    {field:'value',title:'MyValue',width:100,resizable:false,
    formatter: function(value){
    return value ? value : 'NULL';
    }
}
    ]]
})


Title: Re: Propertygrid formatter function as in Datagrid
Post by: WizPS on July 23, 2020, 09:03:00 AM
Perfect, works fine. Thanks!