new ConditionalFormat(oConditionalFormats, oOptions)
Every option of the ConditionalFormatOptions type has associated a property of the ConditionalFormat object. For instance, the option:
expression {string}, specifies the condition of the conditional formatis associated with the property:
Expression {string}, specifies the condition of the conditional formatwhich means that the following statements are equivalent:
oConditionalFormat.Options = {expression: "%0 >= 0"}where oConditionalFormat is an object of ConditionalFormat type
oConditionalFormat.SetOptions({expression: "%0 >= 0"})
oConditionalFormat.Expression = "%0 >= 0"
oConditionalFormat.Setexpression("%0 >= 0")
The ConditionalFormat type defines additional properties and methods of the ConditionalFormat(extree) type. Use the ConditionalFormat(id) method to get the conditional-format based on its index or identifier/key.
Parameters:
| Name | Type | Description |
|---|---|---|
oConditionalFormats |
ConditionalFormats | Indicates an object of ConditionalFormats type that's the owner collection of this conditional format. |
oOptions |
object | Specifies an object of ConditionalFormatOptions type that holds information about the conditional format, such as expression, shape and so on. |
Members
ApplyTo :any
Type:
- any
Example
null{null} or -1 {number}, the format is applied to items (negative-number)
0 {number}, the format is applied to all cells of the conditional format with the index 0 that verify the condition
"C1,C2" {string}, the format is applied to all cells of the columns "C1" and "C2" that verify the condition
ApplyTo
ApplyToBars :any
Type:
- any
Example
null{null}, undefined{undefined} or ""{string}, the format is not applied to a bar
"Task,Milestone" {string}, the format is applied to bars of "Task" or "Milestone" type
ApplyToBars
BarShape :any
The BarShape property can be any of the following:
- {null}, no custom-shape is applied
- the shape's name within the exontrol.BarShape.Tree or exontrol.BarShape namespace
- a CSS color
- a JSON string-representation of an object of exontrol.Def.BarShape type, for the column itself
- an object of {normal,hover,click,disabled} type. The normal, hover, click and disabled are objects of exontrol.Def.BarShape type
Type:
- any
Example
"" {string}, null {null}, no shape is applied
"red" {string}, fills the object's background in red (CSS color)
"Button" or exontrol.BarShape.Button {object}, applies the "Button" shape on the object as defined into exontrol.BarShape namespace
BarShape
Enabled :boolean
Type:
- boolean
Example
false {boolean}, disables the condition (no format or shape is applied if the condition is invalid or disabled)
true {boolean}, enables the condition
Enabled
Expression :string
The conditional format's expression supports the following:
value, gets the value of the cell being formatted/evaluatedThe expression supports the following variables:
%0, %1, %2, ... specifies the value of the cell in the conditional format with the index 0, 1 2, ...The expression supports the following functions:
%C0, %C1, %C2, ... specifies the caption of the cell, or the string the cell displays in the conditional format with the index 0, 1 2, ...
%CD0, %CD1, %CD2, ... specifies the cell's user-date in the conditional format with the index 0, 1 2, ...
%CS0, %CS1, %CS2, ... specifies the cell's state in the conditional format with the index 0, 1 2, ...
index, gets the index of the itemThe Expression property is equivalent with the GetExpression and SetExpression methods.
rindex, returns the recursive-index of the item
pos, returns the relative position of the item (the position within the parent's children collection)
rpos, returns the recursive relative-position of the item (the position within the parent's children collection)
opos, returns the relative old position of the item (the position within the parent's children collection)
ropos, returns the recursive relative-old-position of the item (the position within the parent's children collection)
apos, returns the absolute position of the item (the position from the first visible item)
rapos, returns the recursive absolute-position of the item (the position from the first visible item)
Type:
- string
Example
"1" {string}, highlights all cells or items.
"%0 >= 0" {string}, highlights the cells or items, when the cells in the first conditional format have the value greater or equal with zero
"%0 startwith 'A'" {string}, highlights the cells or items, when the cells in the first column starts with A
Expression
Key :string
Type:
- string
Example
"cond" {string}, defines the conditional format with the giving key (cond). You can use the ConditionalFormats.Item("cond") method to request the conditional format giving its key.
Key
Options :ConditionalFormatOptions
Type:
Example
The following statements are equivalents:
oConditionalFormat.SetOptions({expression: "%0 > 10", shape: "red"}), sets the conditional format's expression and shape
oConditionalFormat.Options = {expression: "%0 > 10", shape: "red"}, sets the conditional format's expression and shape
oConditionalFormat.Expression = "%0 > 10"; oConditionalFormat.Shape = "red";, sets the conditional format's expression and shape
where oConditionalFormat is an object of ConditionalFormat type
Options
Shape :any
- {null}, no custom-shape is applied
- the shape's name within the exontrol.Shapes.Gantt or exontrol.Shapes namespace
- a CSS color
- a JSON string-representation of an object of exontrol.Def.Shape type
- an object of {normal,hover,click,disabled} type. The normal, hover, click and disabled are objects of exontrol.Def.Shape type
The Shape property is equivalent with the GetShape and SetShape methods. The Expression property specifies the condition to verify for the shape to be applied on items or columns. The Shape property specifies the shape to apply on items or columns that verify the condition. By default, no shape is applied for the conditional format itself (conditional format's header).
Type:
- any
Example
null {null}, no custom-shape is applied
"#FF0000" {string}, applies a red color as shape
"lime" {string}, applies a lime color as shape
"Button" {string}, applies the Button shape defined within the exontrol.Shapes namespace
Shape
(readonly) Valid :boolean
Type:
- boolean
Example
The following statement:
if ( oConditionalFormat.Valid ) { ... }, checks whether the expression is syntactically correct
where oConditionalFormat is an object of ConditionalFormat type
Valid
Methods
Remove()
Example
oConditionalFormat.Remove(), removes the conditional format itself from its collection
Remove