How to decorate the text of items that match a condition in an Index
Answer¶
Please use "Server Script" and "Style".
Overview¶
This is a sample code that decorates the text color of the date (DateA) in the "Index" of Pleasanter if the date (DateA) is within one month (including the past). The text-decoration is specified in "Style".
Operation Image¶
Operation Procedure¶
- Create a table
- Create a new "Server Script" and write the following script. Check "Before row display" as the condition and update.
- Create a new "Style" and write the following code. Check "Index" as the output destination and update.
- From the "Editor", activate DateA according to the sample code below.
- Open a new record from the "Create New" button and enter today's date in DateA to create a record.
- Return to the "Index" and confirm that DateA is displayed in red.
Script¶
JavaScript¶
let now = new Date()
let limit = now.setMonth(now.getMonth() + 1);
if (model.DateA <= limit) {
columns.DateA.ExtendedCellCss = 'alert-color';
}
Style¶
The method for specifying elements differs between versions prior to 1.4.20.0 and later versions.
