new Cell(oItem, oColumn)
The Cell object defines a cell within the control. The cell is the intersection of an Item with a Column. The Cell(item,column) method returns the cell based on the item and column. The Cell(id) method of the Item object gets the item's cell giving the column's index, identifier/key/caption or reference.
Every option of the CellOptions type has associated a property of the Cell object. For instance, the option:
cursor {string}, defines the mouse-cursor for individual cellis associated with the property:
Cursor {string}, defines the mouse-cursor for individual cellwhich means that the following statements are equivalent:
oCell.Options = {cursor: "pointer"}where oCell is an object of Cell type
oCell.SetOptions({cursor: "pointer"})
oCell.Cursor = "pointer"
oCell.SetCursor("pointer")
Parameters:
Name | Type | Description |
---|---|---|
oItem |
Item | Indicates the owner item of the cell as an object of Item type |
oColumn |
Column | Indicates the owner column of the cell as an object of Column type |
Methods
Edit(editOptsopt)
The Edit() method edits the current cell.
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
editOpts |
object |
<optional> |
Indicates an object of EditOptions type that holds options to show the cell's editor.
Properties
|
Evaluate(formula) → {any}
The Evaluate() method evaluates the formula and returns the result
Parameters:
Name | Type | Description |
---|---|---|
formula |
string | Indicates the format to evaluate the cell (uses cell/column's format in case it missing)
The format-expression supports the following keywords:
value, indicates the value of the current cell ( "value/2 format ``", displays half of the value using current regional format )The format-expression supports the following unary-operators:
0 index `format`, gets the index of the item (0-based). The first added item has the index 0, the second added item has the index 1, and so on. The index of the item remains the same even if the order of the items is changed by sorting or grouping ( "1 index ``", gets the index of the item starting from 1 )where:
|
Returns:
Returns undefined (invalid formula) or the value of evaluating the formula
- Type
- any
GetColumn() → {Column}
The GetColumn() method gets the cell's column, as an object of Column type
Returns:
Returns the cell's column, as an object of Column type
- Type
- Column
Example
The following statements are equivalents:
oCell.GetColumn(), gets the cell's column, as an object of Column type
oCell.Column, gets the cell's column, as an object of Column type
where oCell is an object of Cell type
GetColumn
GetCursor() → {string}
The GetCursor() method defines the mouse cursor for the cell itself.
Returns:
Returns the mouse-cursor for the cell itself.
- Type
- string
GetData() → {any}
The GetData() method specifies the cell's extra data
Returns:
Returns the cell's extra data.
- Type
- any
GetEnabled() → {boolean}
The GetEnabled() method determines whether the cell is enabled or disabled
Returns:
Returns true if the cell is enabled, or false if the cell is disabled
- Type
- boolean
GetFormat() → {string}
The GetFormat() method specifies the format to display the cell
Returns:
Returns the format to display the cell
The format-expression supports the following keywords:
value, indicates the value of the current cell ( "value/2 format ``", displays half of the value using current regional format )The format-expression supports the following unary-operators:
%0, %1, %2, ... {any} specifies the value of the cell in the column with the index 0, 1 2, ... ( "currency(%0 + %1)", adds the value of first and second cell and displays it as a currency )
%C0, %C1, %C2, ... {string} specifies the caption of the cell, or the string the cell displays in the column with the index 0, 1 2, ... ( "%C0 + %C1", concatenates the caption of first and second cell )
%CD0, %CD1, %CD2, ... {any} specifies the cell's user-date in the column with the index 0, 1 2, ... ( "%CD0 ? value : ``", displays the cell's value only if the cell's data is not empty )
%CS0, %CS1, %CS2, ... {number} specifies the cell's state in the column with the index 0, 1 2, ... ( "(%CS0 ? `<b>` : ``) + value", displays the cell's value in bold only if the first cell is checked )
%CT0, %CT1, %CT2, ... {boolean} returns true if the cell displays a total field; otherwise, it returns false. The exTotalField / exTotalColumn flag specifies whether the cell displays a total field. For instance, "%CT1" refers to all cells in the second column that display totals, while "not %CT1" refers to all cells in the second column that do not display totals (@since 3.3)
%CE0, %CE1, %CE2, ... {boolean} returns true if the cell is editable; otherwise, it returns false.. For example, "%CE0" refers to all editable cells in the first column, while "not %CE1" refers to all cells in the second column that are read-only (@since 3.3)
%CC0, %CC1, %CC2, ... {number} retrieve the number of child items (this keyword consistently returns identical results for all cells since it pertains to the item that hosts each cell). The ChildCount property returns the number of child items. For example, "%CC0" identifies all parent items, while "%CC0 = 0" identifies all leaf items (@since 3.3)
%CX0, %CX1, %CX2, ... {boolean} returns true if the item hosting the cell is expanded, or false if it is collapsed (this keyword consistently returns identical results for all cells since it pertains to the item that hosts each cell). The ExpandItem property specifically indicates whether the item is expanded or collapsed. For example, "%CX0" refers to all expanded items, while "not %CX0" identifies all collapsed items (@since 3.3)
- exp(``), checks whether the item is expanded or collapsed ( "(exp(``) ? `<b>` : ``) + value", shows expanded-items in bold )
- get(`aggregate(list,direction,formula)`), summarizes the cell based on "aggregate(list,direction,formula)" syntax, where:
aggregate, must be one of the following:
Currently, the following items are excluded by aggregate functions:
- sum, performs addition of values
- min, retrieves the minimum value
- max, retrieves the maximum value
- count, counts the number of items
- avg, calculates the average of values
- std, gets standard-deviation of numbers
- a number expression that specifies the index of the item being referred
- all, indicates all items, so the formula is being applied to all items
- current, refers the current item
- parent, refers to the parent item
- root, refers to the root item (the root item has no parent items)
- dir, collects only direct descendents (child-items)
- rec, collects recursivelly the leaf descendents ( leaf items ). A leaf item is an item with no child items
- all, collects all descendents
not-sortable items. The SortableItem property specifies whether the item can be sorted ( a sortable item can change its position after sorting, while a not-sortable item keeps its position after sorting. not-selectable items. The SelectableItem property specifies whether the user can selects/focus the specified item. divider items. The ItemDivider property specifies whether the item displays a single cell, instead displaying whole cells.
In conclusion, aggregate functions counts ONLY items that are sortable, selectable and not a divider-item.
For instance:"get(`count(current,dir,1)`)", gets the count of child-items
"get(`count(current,all,1)`)", gets the count of all child-items (implies recursively child items)
"get(`count(current,rec,1)`)", counts the number of leaf items ( a leaf item is an item with no child items )
"get(`sum(current,dir,%1 ? 1 : 0)`)", counts the number of child-items that have not-empty cells within the second-column
"get(`sum(current,dir,value)`)", gets the total of values of child-items (direct descendent) within the same column
"get(`sum(all,rec,value)`)", gets the total of values of leaf-items within the same column
"get(`sum(parent,dir,dbl(%1) + dbl(%2))`)", gets the addition of all cells in the second (%1) and third (%2) column that are directly descendent of the parent item (sibling)
0 index `format`, gets the index of the item (0-based). The first added item has the index 0, the second added item has the index 1, and so on. The index of the item remains the same even if the order of the items is changed by sorting or grouping ( "1 index ``", gets the index of the item starting from 1 )where:
0 rindex `delimiter|format|format|...`, returns the recursive-index of the item ("1 rindex `.|A-Z`", returns values as A, A.1, A.2, B, ...)
0 pos `format`, returns the relative position of the item (the position within the parent's children collection) ( "1 pos ``", returns the position of the item (1-based) within the parent's child items collection )
0 rpos `delimiter|format|format|...`, returns the recursive relative-position of the item (the position within the parent's children collection) ( "1 rpos `.|A-Z`", returns values as A, A.1, A.2, B, ... )
0 opos `format`, returns the relative old position of the item (the position within the parent's children collection) ( "1 opos ``", returns the position of the item (1-based) within the parent's child items collection )
0 ropos `delimiter|format|format|...`, returns the recursive relative-old-position of the item (the position within the parent's children collection) ( "1 ropos `.|A-Z`", returns values as A, A.1, A.2, B, ... )
0 apos `format`, returns the absolute position of the item (the position from the first visible item) ( "1 apos ``", gets absolute position of the item )
0 rapos `delimiter|format|format|...`, returns the recursive absolute-position of the item (the position from the first visible item) ( "1 rapos `.|A-Z`", returns values as A, A.1, A.2, B, ... )
- `delimiter`, is a character to separated recursive-operators such as "rindex", "rpos", "ropos" and "rapos"
- `format`, is a set of characters to be used for specifying the index
- Type
- string
GetFormatText() → {exontrol.DrawTextFormatEnum}
The GetFormatText() method specifies the format to display the cell's value.
Returns:
Returns a value of exontrol.DrawTextFormatEnum type, that defines the format to display the cell's value.
The exontrol.DrawTextFormatEnum type supports the following flags:
- exTextAlignTop (0x00), justifies the text to the top of the rectangle
- exTextAlignLeft (0x00), aligns text to the left
- exTextAlignCenter (0x01), centers text horizontally in the rectangle
- exTextAlignRight (0x02), aligns text to the right
- exTextAlignVCenter (0x04), centers text vertically
- exTextAlignBottom (0x08), justifies the text to the bottom of the rectangle.
- exTextAlignMask (0x0F), specifies the mask for text's alignment.
- exTextWordBreak (0x10), breaks words. Lines are automatically broken between words if a word would extend past the edge of the rectangle specified by the lpRect parameter. A carriage return-line feed sequence also breaks the line. If this is not specified, output is on one line.
- exTextSingleLine (0x20), displays text on a single line only. Carriage returns and line feeds do not break the line.
- exTextExpandTabs (0x40), expands tab characters. The default number of characters per tab is eight.
- exPlainText (0x80), treats the text as plain text.
- exTextNoClip (0x0100), draws without clipping.
- exHTMLTextNoColors (0x0200), ignores the
and tags. - exTextCalcRect (0x0400), determines the width and height of the text.
- exHTMLTextNoTags (0x0800), ignores all HTML tags.
- exTextPathEllipsis (0x4000), for displayed text, replaces characters in the middle of the string with ellipses so that the result fits in the specified rectangle. If the string contains backslash (\) characters, exTextPathEllipsis preserves as much as possible of the text after the last backslash.
- exTextEndEllipsis (0x8000), for displayed text, if the end of a string does not fit in the rectangle, it is truncated and ellipses are added. If a word that is not at the end of the string goes beyond the limits of the rectangle, it is truncated without ellipses.
- exTextWordEllipsis (0x040000), truncates any word that does not fit in the rectangle and adds ellipses.
- Type
- exontrol.DrawTextFormatEnum
GetHasCheck() → {number}
The GetHasCheck() method indicates whether the cell's check-box or radio-button is visible or hidden.
Returns:
Specifies whether the cell's check-box or radio-button is visible or hidden, as explained:
- null {null}, the column's hasCheck field determines whether the cell's check-box, radio-button is visible or hidden
- 0 {number}, the cell displays no check-box or radio-button
- 1 {number}, the cell displays its check-box.
- 2 {number}, the cell displays its radio-button (only a cell within the children of the parent-item can be checked).
- Type
- number
GetImage() → {string}
The GetImage() method returns the cell's image.
Returns:
Returns the name of the image the current cell displays.
- Type
- string
GetImageAlign() → {number}
The GetImageAlign() method specifies the alignment of the cell's image relative to its value.
Returns:
Returns the alignment of the cell's image relative to its value, as one of the following:
- 0, the image is on the left of the cell's caption
- 1, the image is on the right of the cell's caption
- 2, the image is on the top of the cell's caption
- 3, the image is on the bottom of the cell's caption
- Type
- number
GetImageSize() → {any}
The GetImageSize() method defines the size of the cell's image.
Returns:
Returns the size, range of limits the cell's image is displayed as expalined:
- {undefined}, Indicates that the control's imageSize option is considered, so the cell's image is measured according to the control's imageSize option
- {null}, Indicates that the cell's image is displayed as it is (full-sized).
- {number}, Specifies that the cell's image is displayed into a square of giving size (same width and height). If 0 the object displays no image, if negative the object's image is stretched to giving square, else the object's picture is scaled to fit the giving rectangle.
- {number[]}, Specifies an array of [aspect-width,aspect-height] type that defines the limits for width or/and height. The aspect-width and aspect-height define the width/height of the object's picture to scale or stretch to.
- Type
- any
GetItem() → {Item}
The GetItem() method gets the cell's item, as an object of Item type
Returns:
Returns the cell's item, as an object of Item type
- Type
- Item
Example
The following statements are equivalents:
oCell.GetItem(), gets the cell's item, as an object of Item type
oCell.Item, gets the cell's item, as an object of Item type
where oCell is an object of Cell type
GetItem
GetOptions() → {object}
The GetOptions() method returns the cell's options at once
Returns:
Returns an object of CellOptions type
- Type
- object
Example
The following statements are equivalents:
oCell.GetOptions(), returns the cell's options
oCell.Options, returns the cell's options
where oCell is an object of Cell type
GetOptions
GetPad() → {number|Array.<number>|string}
The GetPad() method specifies the space between cell's content and its borders.
Returns:
Returns a value that could be:
- {number} a numeric value, to pad horizontal and vertical size with the same value
- {(string|number[])} a "x,y" or [x,y] type to specify the padding on horizontal and vertical side
- Type
- number | Array.<number> | string
GetShape() → {any}
The GetShape() method defines the shape for the cell itself.
Returns:
Returns the shape for the cell itself, as one of the following:
- {null}, no custom-shape is applied on the object (default-shape may be applied instead)
- the shape's name within the exontrol.Shape.Tree or exontrol.Shape namespace
- a CSS color
- a JSON string-representation of an object of exontrol.Def.Shape type, for the column itself
- an object of {normal,hover,click,disabled} type. The normal, hover, click and disabled are objects of exontrol.Def.Shape type
- Type
- any
GetState() → {number}
The GetState() method specifies the cell's state (unchecked or checked).
Returns:
Returns the cell's state, as one of the following:
- 0 {number}, the cell is unchecked
- 1 {number}, the cell is checked
- 2 {number}, the cell is partially-checked (valid for cells of check-box type)
- Type
- number
GetToolTip() → {string}
The GetToolTip() method returns the cell's predefined tooltip
Returns:
Returns cell's predefined tooltip
- Type
- string
GetValue() → {any}
The GetValue() method returns the cell's value
Returns:
Returns cell's exHTML value
- Type
- any
SetCursor(value)
The SetCursor() method changes the mouse cursor for the cell itself.
Parameters:
Name | Type | Description |
---|---|---|
value |
any | A string expression that defines the mouse cursor for the cell itself. |
Example
"pointer" {string}, The cursor is a pointer that indicates a link (typically an image of a pointing hand)
SetCursor
SetData(value)
The SetData() method changes the cell's extra data
Parameters:
Name | Type | Description |
---|---|---|
value |
any | Indicates the cell's extra data |
Example
0 {number}, the cell's data is 0. For instance, "%CD0 == 0" format-expression selects all cells with the cell's data on 0
"name" {string}, the cell's data is "name". For instance, "%CD0 like `name*`" format-expression selects all cells with the cell's data starting with "name"
SetData
SetEnabled(value)
The SetEnabled() method enables or disables the cell
Parameters:
Name | Type | Description |
---|---|---|
value |
boolean | Indicates a boolean expression that specifies whether the cell is enabled or disabled |
Example
false {boolean}, disables the cell
true {boolean}, enables the cell
SetEnabled
SetFormat(value)
The SetFormat() method formats the cell's content.
Parameters:
Name | Type | Description |
---|---|---|
value |
string | Indicates the format to display the cell
The format-expression supports the following keywords:
value, indicates the value of the current cell ( "value/2 format ``", displays half of the value using current regional format )The format-expression supports the following unary-operators:
0 index `format`, gets the index of the item (0-based). The first added item has the index 0, the second added item has the index 1, and so on. The index of the item remains the same even if the order of the items is changed by sorting or grouping ( "1 index ``", gets the index of the item starting from 1 )where:
|
Example
"value format ``" {string}, shows the cell's value formatted as a number (as in regional settings)
"1 index ``" {string}, gets the index (1-based) of the item
"1 rpos `.|A-Z`" {string}, displays A, B, C for root-items, and A.1, A.2, A.1.1, ... B.1, B.2, ... for child-items
"currency(dbl(%0) + dbl(%1))" {string}, adds columns 0 and 1 and displays the result as currency
SetFormat
SetFormatText(value)
The SetFormatText() method changes the format to display the cell's value.
Parameters:
Name | Type | Description |
---|---|---|
value |
exontrol.DrawTextFormatEnum | Specifies a value of exontrol.DrawTextFormatEnum value that defines the format to show the cell's value.
The exontrol.DrawTextFormatEnum type supports the following flags:
|
Example
null {null}, centers the caption
32 or exontrol.DrawTextFormatEnum.exTextSingleLine {number}, defines a single-line caption
0x2A or exontrol.DrawTextFormatEnum.exTextSingleLine | exontrol.DrawTextFormatEnum.exTextAlignRight | exontrol.DrawTextFormatEnum.exTextAlignBottom {number}, defines a single-line caption right/bottom-aligned
SetFormatText
SetHasCheck(value)
The SetHasCheck() method shows or hides the cell's check-box or radio-button is visible or hidden.
Parameters:
Name | Type | Description |
---|---|---|
value |
number | A numeric expression that indicates whether the cell's check-box or radio-button is visible or hidden, as follows:
|
Example
null {null}, the cell's check-box or radio-button is determined by the column's hasCheck field
2 {number}, the cell displays its radio-button (cells of the same parent-item make the group of radio-cells, so only once can be checked at the time). By using the cell's individual hasCheck field on 2, you can specify multiple group of radio-buttons within the same column.
SetHasCheck
SetImage(value)
The SetImage() method changes the cell's image. The image can be added using the exontrol.HTMLPicture.Add() method
Parameters:
Name | Type | Description |
---|---|---|
value |
string | Indicates the name of the image the cell displays. |
SetImageAlign(value)
The SetImageAlign() method changes the alignment of the cell's image relative to its value.
Parameters:
Name | Type | Description |
---|---|---|
value |
number | Indicates the alignment of the cell's image relative to cell's value (0 (left, default), 1(right), 2(top) or 3(bottom))
|
Example
null {null}, the image is aligned left to the caption (default)
1 {number}, the image is displayed to the right of the cell's caption
SetImageAlign
SetImageSize(value)
The SetImageSize() method changes the size of the cell's image.
Parameters:
Name | Type | Description |
---|---|---|
value |
any | Indicates the size of the cell's image as explained:
|
Example
null {null}, Indicates that the object's image is displayed as it is (full-sized).
0 {number}, no image is displayed
64 {number}, the image is scaled to fit a 64 x 64 rectangle
-64 {number}, the image is strected to a 64 x 64 rectangle
[32,64] {array}, scales the image to the largest ratio-rectangle (32 x 64) that fits the client
[-32,-64] {array}, stretches the image to a 32 x 64 rectangle
SetImageSize
SetOptions(oOptions)
The SetOptions() method changes the cell's options (visibility, value, ...) at once
Parameters:
Name | Type | Description |
---|---|---|
oOptions |
object | Specifies an object of CellOptions type that holds information about the cell, such as value, image and so on. If the oOptions parameter is not-of object type it indicates the cell's value instead |
Example
oTree.Cell(0).Options = {image: "al", imageSize: null, imageAlign: 1}, sets the cell's image to its original size, aliged to the right
SetOptions
SetPad(value)
The SetPad() method changes the cell's padding or the space between cell's content and its borders.
Parameters:
Name | Type | Description |
---|---|---|
value |
number | Array.<number> | string | Specifies a value that could be:
|
Example
null {null}, indicates that the default-padding field is used ([4,4])
0 {number}, indicates no padding
"8,4" {string}, increases the element's width with 2 * 8-pixels and element's height with 2 * 4-pixels
[8,4] {array}, increases the element's width with 2 * 8-pixels and element's height with 2 * 4-pixels
SetPad
SetShape(value)
The SetShape() method changes the shape for the cell itself.
Parameters:
Name | Type | Description |
---|---|---|
value |
any | The value could be any of the following:
|
Example
null {null}, no custom shape is applied (default object's shape may be applied)
"" {string}, no custom shape is applied (no default object's shape is be applied)
"red" {string}, fills the object's background in red (CSS color)
'{"fillColor": "red"}' or '{"normal":{"fillColor": "red"}}' {string}, fills the object's background in red (JSON-representation of an object of exontrol.Def.Shape type)
"xxx" {string}, indicates that exontrol.Shapes.Tree.xxx or exontrol.Shapes.xxx is applied on the object's background. If the xxx field is missing, no custom shape is applied (no default object's shape is be applied)
exontrol.Shapes.Button {object}, applies the "Button" shape on the object as defined into exontrol.Shapes namespace
SetShape
SetState(value)
The SetState() method changes the cell's state.
Parameters:
Name | Type | Description |
---|---|---|
value |
number | A numeric expression that specifies the cell's state (unchecked or checked). |
Example
0 {number}, the cell is unchecked
1 {number}, the cell is checked
SetState
SetToolTip(value)
The SetToolTip() method sets the cell's predefined tooltip
Parameters:
Name | Type | Description |
---|---|---|
value |
string | Specifies the new cell's predefined tooltip |
Example
null {null}, the cell's caption is shown once the mouse pointer hovers it, and it is not fully displayed
"" {string}, no tooltip for the cell is displayed
"<img>image</img> and text" {string}, the image and text is being shown once the mouse pointer hovers the cell. The image can be added using the exontrol.HTMLPicture.Add() method
SetToolTip
SetValue(value)
The SetValue() method changes the cell's value
Parameters:
Name | Type | Description |
---|---|---|
value |
any | Specifies a new ex-HTML value to be assigned to the cell |
Example
null {null}, indicates no caption
"caption" {string}, declares a plain-caption
"<b>text</b>" {string}, displays the text in bold
"<img>logo</img>" {string}, displays the "logo" image. The image can be added using the exontrol.HTMLPicture.Add() method
SetValue
ToggleCheck()
The ToggleCheck() method toggles the cell's state from checked to unchecked, and reverse
getPad() → {array}
The getPad() method returns the cell's padding or the space between cell's content and its borders.
Returns:
Returns a 2-cells array as [x,y] type
- Type
- array