conditions

a module for working with conditions

object conditions;

Example

$$("ss").conditions.parse([
  [3, 3, "greater", 5000, "webix_ssheet_condition_good"],
  [3, 3, "lessOrEqual", 5000, "webix_ssheet_condition_bad"],
  [4, 4, "less", 100, "webix_ssheet_condition_bad"]
]);

Related samples

Details

The module has the following property and methods to work with conditions:

  • handlers - (object) a property with the available conditional rules grouped by data type (number, text, date). Each group is an array of objects with the rule id (the name used as rule in add() and parse()) and the handler function
  • add() - adds conditional formatting for a specified cell. Accepts the following parameters:
    • row (number) - row ID
    • col (number) - col ID
    • rule (string) - conditional rule
    • value (number, string, array) - the value to compare with; an array [start, end] for the "between" and "notBetween" rules
    • css (string) - CSS class name to apply
    • page (string) - optional, the name of the sheet. If not specified, the method is applied to the current sheet
  • clear() - clears all the conditional formatting from the current sheet. Accepts the following parameter:
    • page (string) - optional, the name of the sheet. If not specified, the method is applied to the current sheet
  • get() - returns an array of all the conditional formatting rules of a specified cell. Accepts the following parameters:
    • row (number) - row ID
    • col (number) - col ID
    • page (string) - optional, the name of the sheet. If not specified, the method is applied to the current sheet
  • parse() - parses conditional formatting rules into the current sheet. Accepts the following parameters:
    • data (array) - conditional formatting data where each element is an array like this [rowID, colID, rule, value, css]
    • page (string) - optional, the name of the sheet. If not specified, the method is applied to the current sheet
  • remove() - removes conditional formatting from a specified cell. Accepts the following parameters:
    • row (number) - row ID
    • col (number) - col ID
    • page (string) - optional, the name of the sheet. If not specified, the method is applied to the current sheet
  • serialize() - returns a 2D array analogous to the one described in the parse() method. Accepts the following parameter:
    • page (string) - optional, the name of the sheet. If not specified, the method is applied to the current sheet
  • update() - updates conditional formatting of a specified cell. Accepts the following parameters:
    • row (number) - row ID
    • col (number) - col ID
    • newData (array) - a 2D array where each element is an array like this [rule, value, css]
    • page (string) - optional, the name of the sheet. If not specified, the method is applied to the current sheet
See also
Back to top
Join Our Forum
We've retired comments here. Visit our forum for faster technical support, connect with other developers, and share your feedback there.