EasyUI Forum
May 13, 2024, 04:35:11 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: Propertygrid formatter function as in Datagrid  (Read 3478 times)
WizPS
Jr. Member
**
Posts: 67


View Profile
« 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?
Logged
jarry
Administrator
Hero Member
*****
Posts: 2264


View Profile Email
« Reply #1 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';
    }
}
    ]]
})
Logged
WizPS
Jr. Member
**
Posts: 67


View Profile
« Reply #2 on: July 23, 2020, 09:03:00 AM »

Perfect, works fine. Thanks!
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!