Aras Innovator Platform

Common objects description

This section describes common objects frequently used in the DynamicTreeGrid public methods.

Metadata objects

A Metadata object is an object that contains additional information about a cell that is required for the grid editors and formatters to render the cell properly.

A Metadata object can have the following properties:

  • formatter – optional property.

The formatter name used to display cell content. If you do not specify a “formatter” property, the formatter type is determined by the grid based on the cell value. E.g., if the cell value is a string the ‘text’ formatter will be used, and if the cell value is boolean the ‘boolean’ formatter will be used.

  • editor – optional property.

The name of the editor used to display cell content when the cell is in the edit state. If you do not specify an “editor” property, the editor type will be determined by the grid.

  • Other properties that can be used in the formatter and editor functions from the “metadata” parameter.

Example:

{

formatter: ‘select’,

editor: ‘select’, 

options:     [
                                            

{label: 'Red', value: 'id1'}, 

{label: 'Green', value: 'id2'}, 

{label: 'Blue', value: 'id3'}

]

}

Column settings object

The Column settings object contains additional settings applicable to the corresponding column.

If a grid is not editable/resizable/sortable, then you cannot edit/resize/sort columns. However, if the grid is editable/resizable/sortable you can adjust these columns. The Column setting does not change when the corresponding grid setting is changed.

The Column settings object can have the following optional properties:

  • resizable enables you to decide whether to resize a column. The default value is obtained from grid settings when adding a new column.
  • editable enables you to decide whether to edit cells in this column. The default value is obtained from grid settings when adding a new column. This setting value will be used as a default value for the cell’s editability setting when adding new rows. You can also use the “setCellEditability” and “getCellEditability” methods to set/get cell editability.
  • sortable enables you to decide whether to sort by this column. The default value is obtained from the grid settings when adding a new column.
  • visible enables you to decide if the column should be visible or not. The Default value is true when adding a new column.

Example:

{

resizable: false,

sortable: true,

editable: false,

visible: true

}

Column object

The Column object is used in the “loadData” and “addColumn” methods. It can contain the following properties:

  • name – required property. Column name.
  • label – optional property. The column name is used as the label if the “label” property is not set.
  • width – optional property. The width is calculated automatically based on the column label if the “width” property is not set.
  • metadata – optional property. It contains a metadata object for all cells in this column. Column metadata is used only for cells without their own metadata.
  • settings – optional property containing settings that are applied to the corresponding column.

Example:

{

label: ‘Column 1’,

width: 100,

name: ‘property1,

metadata: {

formatter: ‘boolean’

},

settings: {

resizable: false,

editable: false

}

}

Row object

The Row object is used in the “loadData” and “addRows” methods. It can contain different properties. If the row object property name matches the column name, then its value is used as a cell value. The Row object property is updated automatically when the corresponding grid cell value is changed.

Example:

{

property1: ‘value 1’,

property2: ‘value 2’,

someOtherProperties: ‘additional property’

}