Columns class (Tree)

Columns(oTree)

new Columns(oTree)

The Columns object holds a collection of Column objects (column of the control). Use the Columns/GetColumns() method to access the control's columns collection.
Parameters:
Name Type Description
oTree Tree Indicates an object of Tree type that owns the collection
Columns

Methods

Add(oColumnOptsopt) → {Column}

The Add() method creates and adds a new column into the control.
Parameters:
Name Type Attributes Description
oColumnOpts object <optional>
Specifies the options to create the new column as an object of ColumnOptions type. If no object is provided, it specifies the column's caption
Returns:
Returns the newly created column, as an object of Column type
Type
Column
Example
oTree.Columns.Add(), adds a new column with no caption
 oTree.Columns.Add("&lt;b>Info&lt;/b> Col"), adds a new column
 oTree.Columns.Add({caption:"<b>Info</b> Col", width: 64, allowSizing: false}), adds a new non-resizable column of specified width
 oTree.EnsureVisibleClient(oTree.Columns.Add({caption:"<b>Info</b> Col", width: 64, allowSizing: false})), adds a new non-resizable column of specified width, and ensures that the column fits the control's client area
Add

Clear()

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

GetCount() → {number}

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

 oTree.Columns.GetCount(), returns the number of columns within the collection
 oTree.Columns.Count, returns the number of columns within the collection

where oTree is an object of Tree type
GetCount

GetSorts() → {string}

The GetSorts() method returns all columns being sorted within the control (including the single-sort column)
Returns:
Returns a string-representation that includes all columns being sorted within the control, such as "C1:A C2:D, C0:A" as explained:
"C1" and "C2" columns are displayed within the control's sort-bar
"C0" specifies the control's single-sort column
Type
string
Example
The following statements are equivalents:

 oTree.Columns.GetSorts(), returns all columns being sorted within the control (including the single-sort column)
 oTree.Columns.Sorts, returns all columns being sorted within the control (including the single-sort column)

where oTree is an object of Tree type
GetSorts

Item(id) → {null|Column}

The Item() method gets the column giving its index, identifier/key/caption or reference. Use the Column(id) method to get the column based on its index or identifier/key.
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 column to request
  • id {string}, specifies a string expression that defines the identifier/key/caption/plain-caption of the column to request
  • id {Column}, specifies the object reference to the column to request for
Returns:
Returns null(the column is not found), or an object of Column type, if the columns collection contains the giving id.
Type
null | Column
Item

Items(range) → {object}

The Items() method gets a collection of columns giving its index, identifier/key/caption separated by comma character.
Parameters:
Name Type Description
range any The range parameter could be any of the following:
  • range {number}, indicates a numeric value that defines the index of the column to request
  • range {string}, specifies a list of index/identifier/key/caption/plain-caption, separated by comma character
  • range {Column}, specifies the object reference to the column to request for
Returns:
Returns an object of exontrol.Arr([Column]) type.
Type
object
Items

Remove(id)

The Remove() method removes a column 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 column to request
  • id {string}, specifies a string expression that defines the identifier/key/caption/plain-caption of the column to request
  • id {Column}, specifies the object reference to the column to request for
Remove

SetSorts(Specifies)

The SetSorts() method sorts multiple-columns at once giving a string-representation such as "C1:A C2:D, C0:A"
Parameters:
Name Type Description
Specifies string a string-representation that includes all columns being sorted within the control, such as "C1:A C2:D, C0:A" as explained:
"C1" and "C2" columns are displayed within the control's sort-bar
"C0" specifies the control's single-sort column
SetSorts