Introduction
In Table Editor, you can use the IF function in the renderer to display content based on conditions, similar to how you use the IF
function in Excel.
For example, if you have a column containing license types (user
, concurrent
, site
), you can display the corresponding description using an IF
condition in the renderer.
Steps to Implement
Step 1: Identify the Column Index
- Table Editor indexes columns starting from 0 (i.e., the first column is
row[0]
, the second column isrow[1]
, and so on). - If the column you want to check is the third column from the left, its index in the renderer will be
row[2]
.
Step 2: Add Code to the Renderer Field
- Select the column where you want to display content based on a condition.
- Click “Style” in the column settings.
- In the “Renderer” field, add the following code:
if (row[2] == 'user') {
'user license description';
} else if (row[2] == 'concurrent') {
'concurrent license description';
} else {
'site license description';
}
Step 3: Save and Verify the Output
- Click “Save” to apply the configuration.
- Check the table to ensure that the content is displayed correctly according to the conditions set.
Conclusion
By using the IF function in the renderer, you can easily customize the displayed content based on the value of a specific column. If you need more complex conditions, you can expand the code with additional else if
conditions or use advanced JavaScript syntax.