How to show "Yes" and "No" instead of "true" and "false" in bool type column of a ejs-grid?

Hi,

The display value in bool type column of ejs-grid are "true" or "false",  our customer require to display "Yes" or "No", please help.


Thanks,

CZ


5 Replies

SK Sujith Kumar Rajkumar Syncfusion Team October 15, 2021 08:28 AM UTC

Hi Zhao, 
 
Greetings from Syncfusion support. 
 
We are not able to clearly understand your requirement from the provided information. So please confirm us the following details to validate further on this, 
 
  • Is your requirement to modify the ‘true’, ‘false’ values in the data source Boolean field to ‘yes’, ‘no’ in the UI alone?
  • If not, is your requirement to update ‘yes’, ‘no’ values for Boolean column in the data source?
 
If your requirement does not come under the above cases, then please elaborate on your exact requirement to check further based on that. 
 
Regards, 
Sujith R 



CZ CZ October 15, 2021 12:02 PM UTC

Hi Sujith,


We don't want to modify values in data source, we only want to change UI alone, display 'yes', 'no' in the Boolean field.


Thanks,

CZ



SK Sujith Kumar Rajkumar Syncfusion Team October 18, 2021 06:47 AM UTC

Hi CZ, 
 
Thanks for the confirmation. You can achieve your requirement of customizing the value in UI by modifying the cell element value for the Boolean type column in the Grid’s queryCellInfo event handler as demonstrated in the below code snippet, 
 
// Grid’s queryCellInfo event handler 
queryCellInfo: function (args) { 
    // Check if the event is executed for the Boolean column 
    if (args.column.field === "Verified") { 
        var newVal = args.cell.innerText === "true" ? "Yes" : "No"; 
        // Here the cell value is modified in the UI level 
        args.cell.innerText = newVal; 
    } 
} 
 
We have prepared a sample based on this for your reference. You can find it below, 
 
 
 
Please get back to us if you require any further assistance. 
 
Regards, 
Sujith R 



CZ CZ replied to Sujith Kumar Rajkumar October 18, 2021 09:12 PM UTC

It works,


Thanks,



SK Sujith Kumar Rajkumar Syncfusion Team October 19, 2021 06:06 AM UTC

Hi CZ, 
 
We are glad to hear that your query has been resolved. 
 
Regards, 
Sujith R 


Loader.
Up arrow icon