ConditionalFormats class (Tree)

ConditionalFormats(oTree)

new ConditionalFormats(oTree)

The ConditionalFormats object holds a collection of ConditionalFormat type. The conditional formatting feature allows you to apply formats to a cell or range of cells, and have that formatting change depending on the value of the cell or the value of a formula. Use the ConditionalFormats/GetConditionalFormats() method to get the control's conditional formats.
Parameters:
Name Type Description
oTree Tree Indicates an object of Tree type that owns the collection
ConditionalFormats

Methods

Add(oConditionalFormatOpts) → {ConditionalFormat}

The Add() method creates and adds a new conditional format into the control
Parameters:
Name Type Description
oConditionalFormatOpts object Specifies the options to create the new conditional format as an object of ConditionalFormatOptions type. If no object is provided, it specifies the conditional format's caption
Returns:
Returns the newly created conditional format, as an object of ConditionalFormat type
Type
ConditionalFormat
Example
oTree.ConditionalFormats.Add(
 {
   expression: "%0 = 'ZL35'",
   shape: "red",
   applyTo: 0
 }, shows the cells of the first column with the caption ZL35 on red
 
 oTree.ConditionalFormats.Add(
 {
   expression: "%1 contains '2'",
   shape: "green"
 }), shows each item in green, where the second-cell includes "2"

 oTree.ConditionalFormats.Add(
 {
   expression: "%2 > 10",
   shape:
   {
     tfi:
     {
       bold: true
     }
   }
 }), bolds items, where values in the third-column are greater than 10
Add

Clear()

The Clear() method removes all conditional formats of the control and inits the control's scroll-bars
Clear

GetCount() → {number}

The GetCount() method returns the number of conditional formats within the collection
Returns:
Returns the number of conditional formats within the collection
Type
number
Example
The following statements are equivalents:

 oTree.ConditionalFormats.GetCount(), counts the conditional formats within the collection
 oTree.ConditionalFormats.Count, counts the conditional formats within the collection

where oTree is an object of Tree type
GetCount

Item(id) → {ConditionalFormat}

The Item() method gets the conditional format by index, key or reference
Parameters:
Name Type Description
id any The id parameter could be any of the following:
  • id {number}, indicates a numeric value that defines the index of the conditional format to request
  • id {string}, specifies a string expression that defines the identifier/key of the conditional format to request
  • id {ConditionalFormat}, specifies the object reference to the conditional format to request for
Returns:
Returns null(the conditional format is not found), or an object of ConditionalFormat type, if the conditional formats collection contains the giving id.
Type
ConditionalFormat
Item

Remove(id)

The Remove() method removes a conditional format from the collection.
Parameters:
Name Type Description
id any The id parameter could be any of the following:
  • id {number}, indicates a numeric value that defines the index of the conditional format to request
  • id {string}, specifies a string expression that defines the identifier/key of the conditional format to request
  • id {ConditionalFormat}, specifies the object reference to the conditional format to request for
Remove

RemoveRange(range)

The RemoveRange() method removes multiple-conditional formats at once
Parameters:
Name Type Description
range any Indicates a conditional format, an array [ConditionalFormat], or exontrol.Arr.
RemoveRange