With the Servoy 4.x release, some additional parameters has been added to the RowBGColorCalculation to give the developer more control on managing the colors for the records in Table and List View.
With this release additional parameters are available with the calculation/global method, that you have set in the ‘rowBGColorCalculation’ property of the form. Here, are the list of the parameters and their details.
arguments[0] = Specifies the Row Index arguments[1] = Specifies the Row has been selected or not arguments[2] = Specifies the Display Type of each field placed in the form(ex: TYPE_AHEAD) arguments[3] = Specifies the Data Provider of each field placed in the form arguments[4] = Specifies the Form Name on which the RowBGColorCalculation is currently executing
arguments[5] = Specifies the Record Object
You can use these arguments/parameters in your rowBGColorCalculation to colorize the records according to your need.
As an example, one of my Form is based on ‘projects’ table. I would like to list all the records of the table and also like to mark all the over-due projects to RED color. The below method will do this for me.
// get the current date-time stamp
var currentDateTime = application.getServerTimeStamp();
// get the selected record object
var curRecord = arguments[5];
// evaluate the due-date-time of the selected record
var curProjectDueDateTime = curRecord.due_datetime;
// evaluate and return colors if((curProjectDueDateTime != null)
&& (curProjectDueDateTime.getTime() < currentDateTime.getTime()) ) {
// project has already overdue; return RED color return ‘#ff0000’; } else { // not overdue; return WHITE color return ‘#ffffff’;
}