Articles in this section
Category / Section

How to perform conditional formatting on JavaScript tree grid cells?

1 min read

In JavaScript tree grid, using the queryCellInfo client-side event, the cells can be customized at the initial load. This event contains cell value, HTML cell element, column value and row data as event arguments. Using these information, the cell can be customized. The below code snippet explains how to highlight the cell of duration field with a specific value.

$(function () { 
$("#TreeGridContainer").ejTreeGrid({
dataSource: data,                                
//. . .
//. . .
queryCellInfo: "queryCellInfo",
});
});
function queryCellInfo(args) {
if (args.column.field == "duration") {
var cellValue = args.data.item.duration;
if (cellValue == 5)
args.cellElement.bgColor = "#FA7F7F";
}
}

 

The below screenshot depicts the above code example for highlighting cells based on a condition.

Customize the cell of duration field in JavaScript TreeGrid

A sample with customized tree grid cell is available here

 

 

 

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied