DataGrid
Description
The DataGrid
class represents the main class for the DataGrid
. It exposes functions to specify how it looks and behaves. It can be configured by providing options at construction, or dynamically by calling its different functions at runtime.
Get Functions
Function Name |
Parameter |
Type |
Return type |
Description |
---|---|---|---|---|
getOptions |
|
|
Returns the |
|
getColumnDefinitions |
|
|
Returns an array of |
|
getColumnDefinitionById |
id |
string |
|
Returns a |
getColumnDefinitionsById |
ids |
string[] |
Returns an array of |
|
getDataSource |
|
|
|
Returns the |
getFilterDefinitions |
|
|
Returns a collection of key/value pairs representing the |
|
getGroupDefinitions |
|
|
Returns an array of |
|
getSelectedItems |
|
Returns an array of |
||
getSelectedCellRanges |
|
Returns an array of |
||
getSortDefinitions |
|
|
Returns an array of |
|
getValidationErrors |
|
|
Returns an array of |
Set Functions
Function Name |
Parameter |
Type |
Description |
---|---|---|---|
constructor |
container, options? |
Container is the root html element which serves as the parent element containing the |
|
setOptions |
options |
An object containing options to apply to the |
|
setColumnDefinitions |
columnDefinitions |
An array of |
|
addColumnDefinitions |
columnDefinitions |
An array of |
|
insertColumnDefinitions |
index, columnDefinitions |
number, |
An array of |
upateColumnDefinitions |
columnDefinitions |
An array of |
|
removeColumnDefinitions |
ids |
string[] |
An array of string identifying |
addEventListener |
eventName, listener |
T, |
Adds a listener that fires whenever the event specified by eventName is raised in the |
removeEventListener |
eventName, listener |
T, |
Unsubscribes the listener from the event specified by eventName. |
setDataSource |
dataSource |
A |
|
setFilterDefinitions |
filterDefinitions |
A collection of key/value pairs representing the |
|
setGroupDefinitions |
groupDefinitions |
An array of |
|
setSortDefinitions |
sortDefinitions |
An array of |
Example
let columnDefinitionToUpdate = datagrid.getColumnDefinitionById("weight");
columnDefinitionToUpdate.title = "Weight (kg)"
datagrid.updateColumnDefinitions([columnDefinitionToUpdate]);
In this example, the column with id “weight” is retrieved, and its title property updated, and given back to the DataGrid
.