Data Grid
Last updated
Was this helpful?
Last updated
Was this helpful?
(part of package '') Extends designtime/SolutionModel: Extends runtime:
Data Grid is a table with advanced functionality that operates on JSFoundset data (so it can work directly with the database). It is designed to work with a large number of rows, potentially infinite, since data is loaded lazily into the table, even when grouped.
This is a reference page; many components have detailed usage guides .
Defines action on TEXTFIELD editor for up/down arrow keys Type:
When true the row has a checkbox for selecting/unselecting Type: Default Value: false
List all columns to be used in table as dataprovider Type:
Auto sizing for columns. SIZE_COLUMNS_TO_FIT: make the currently visible columns fit the screen. AUTO_SIZE: the grid will work out the best width to fit the contents of the 'visible' cells in the column. NONE: no auto sizing action performed Type: Default Value: null
Called when the mouse is clicked on a row/cell. The foundsetindex is always -1 when there are grouped rows. If a column is disabled (enabled = false), ensure that you only execute code for that column if columnindex corresponds to it.
@private
Parameters:
Called when the mouse is double-clicked on a row/cell. The foundsetindex is always -1 when there are grouped rows. If a column is disabled (enabled = false), ensure that you only execute code for that column if columnindex corresponds to it.
@private
Parameters:
Called when the right mouse button is clicked on a row/cell. The foundsetindex is always -1 when there are grouped rows. If a column is disabled (enabled = false), ensure that you only execute code for that column if columnindex corresponds to it.
@private
Parameters:
Called when the columns data is changed
Parameters:
Called when the column's form editor is started
Parameters:
Called when the columns state is changed
Parameters:
Called when a custom main menu item is chosen.
Parameters:
Called when a row is dropped as a result of a drag-n-drop
Parameters:
Called when the mouse is clicked on a footer cell
Parameters:
Called when the table is ready to be shown
Called when group is opened/closed
Parameters:
Called when the selected rows have changed.
Parameters:
Called when sort has changed
Parameters:
Add a Servoy solution function to the grid, that can be called from AGGRID using params.context.componentParent.executeFunctionCall
Example:
Parameters:
Auto-sizes all columns based on content.
Start cell editing (only works when the table is not in grouping mode).
Parameters:
Returns the selected headers or groups in the table when the headerCheckbox or groupCheckbox property is used. The returned value is an array of objects, where each object represents a selected group or header. Each object includes a `colId` representing the column identifier and, for groups, a `groupkey` representing the group key. For headers, the `groupkey` property is not included.
Example:
Gets the column at index. Index is 0 based.
Example:
Parameters:
Gets the column with id colId
Example:
Parameters:
Return the column index for the given column id. Can be used in combination with getColumnState to retrieve the column index for the column state with colId in the columnState object.
Example:
@public
Parameters:
Returns the current state of the columns (width, position, grouping state) as a json string that can be used to restore to this state using restoreColumnState
Gets the number of columns
Example:
Returns currently expanded groups as an object like: {expandedGroupName1:{}, expandedGroupName2:{expandedSubGroupName2_1:{}, expandedSubGroupName2_2:{}}}
Returns the selected rows when in grouping mode
Returns the view column corresponding to the given column ID.
Parameters:
Returns an array of view columns currently visible in the grid.
Returns true if the ToolPanel is showing
Move column
Parameters:
Adds new column at specified index. Index is 0 based.
Example:
Parameters:
Notify the component about a data change. Makes the component aware of a data change that requires a refresh data.
Call this method when you are aware of a relevant data change in the foundset which may affect data grouping (e.g. group node created or removed). The component will alert the user of the data change and it will suggest to the user to perform a refresh.
Please note that it’s not necessary to notify the table component if the component is not visible; the component will always present the latest data when rendered again.
@public
Force a full refresh of the data.
WARNING ! be aware that calling this API results in bad user experience since all group nodes will be collapsed instantaneously.
@public
Removes all columns.
Example:
Removes column from specified index. Index is 0 based.
Example:
Parameters:
Request focus on the given column
Parameters:
Restore columns state to a previously save one, using getColumnState.
If no argument is used, it restores the columns to designe time state. If the columns from columnState does not match with the columns of the component, no restore will be done.
The optional boolean arguments: columns, filter, sort can be used to specify what to restore: - the columns size/position/visibility (default true), - the filter state (default false), - the sort state (default false).
Parameters:
Scroll to the selected row
Sets the selected headers or groups in the table when the headerCheckbox or groupCheckbox property is used. The input should be an array of objects where each object represents a selected group or header. The objects should have a `colId` representing the column identifier, and optionally a `groupkey` representing the key of the group. For headers, the `groupkey` should not be included.
Example:
Example:
Parameters:
Sets expanded groups
Parameters:
Set the filter model. This api maps to ag-grid's setFilterModel; for more details on the model's structure check this page: https://www.ag-grid.com/angular-data-grid/filter-api/ To clear the filter, use an empty object ({}) as filterModel;
NOTE: The name of the columns from the model are the id properties of the column.
Example:
@public
Parameters:
Set the currently opened form editor value
Parameters:
Set the selection in grouping mode 111. The table must be already in grouping mode, and the record already loaded (the group of the record expanded - see: setExpandedGroups)
Parameters:
Set the table read-only state. If no columnids is used, all columns read-only state is set, otherwise only for the columns specified.
Parameters:
Show or hide the ToolPanel
Parameters:
Adjusts the columns' widths to fit the available viewport, ensuring that all visible columns are resized to fill the table's width. This method dynamically resizes columns to ensure no empty space remains in the grid's horizontal viewport.
Example:
If a cell is editing, it stops the editing
Parameters:
Type definition for a grid column. scripting type: CustomType<aggrid-groupingtable.column>
autoResize
Enables auto-resizing for the column.
Default Value: true
columnDef
Map where additional column properties of ag-grid can be set
dataprovider
Data provider identifier for the column.
dndSource
Allow dragging
Default Value: false
dndSourceDataprovider
Boolean dataprovider for allow/disallow dragging.
editForm
Form used as custom editor
editFormSize
Size configuration for the custom editor form.
Default Value: {"width":300,"height":200}
editType
Type of editing used for that column
enableResize
Allows resizing of the column.
Default Value: true
enableRowGroup
Allow the user to group or ungroup the column
Default Value: true
enableSort
Allows sorting on this column.
Default Value: true
enableToolPanel
If the column should be visible in the tool panel
Default Value: true
enabled
Flag indicating if the column is enabled.
Default Value: true
excluded
When true the column is excluded from the UI
Default Value: false
filterType
Filter type to be used for this column.
footerStyleClass
CSS class for the column footer.
footerText
Footer text to display in the column.
footerTextShowAs
Defines how the footer text is rendered (e.g., inline, tooltip).
format
Format pattern for the column's data.
headerCheckbox
When true the column has checkbox for selecting/unselecting all rows
Default Value: false
headerGroup
Header group, that this column will be part of
headerGroupStyleClass
CSS class for the header group.
headerIconStyleClass
(Font awesome) Styles for header icon
headerStyleClass
CSS class for the column header.
headerTitle
If the column has a database linked dataprovider, the default value of the headerTitle is the title text of the database column or if that is not set, the database column name.
headerTooltip
Tooltip text for the header.
id
Used to set the column id (colId) property in the serialized column state json string of getColumnState and onColumnStateChanged
isEditableDataprovider
Use a Servoy calculation as isEditableDataprovider to set edit state conditionally to the table cell
maxWidth
Maximum width in pixels.
minWidth
Minimum width in pixels.
rowGroupIndex
Set the rowGroupIndex to group on the column; the index defines the order of the group when there are multiple grouped columns
Default Value: -1
showAs
Defines an alternative display mode for the column.
stopEditingOnChange
When true, editing stops on change.
Default Value: false
styleClass
CSS class for the cell.
styleClassDataprovider
Use a Servoy calculation as styleClassDataprovider to set styleClass conditionally to the table cell
tooltip
Tooltip text for the cell.
valuelist
Value list used to map column values.
valuelistConfig
Configuration for the value list.
visible
Visibility state of the column.
Default Value: true
width
Column width in pixels.
Default Value: 0
Events that trigger auto-sizing of columns. scripting type: CustomType<aggrid-groupingtable.columnsAutoSizingOn>
columnResize
Apply 'columnsAutoSizing' when columns are resized
Default Value: true
columnRowGroupChange
Apply 'columnsAutoSizing' when row grouping is changed
Default Value: true
displayedColumnsChange
Apply 'columnsAutoSizing' when columns are added/removed
Default Value: true
gridReady
Apply 'columnsAutoSizing' when grid is ready to be shown
Default Value: true
gridSizeChange
Apply 'columnsAutoSizing' when grid size changes
Default Value: true
toolPanelVisibleChange
Apply 'columnsAutoSizing' when the toolpanel visibility is changed
Default Value: true
Definition for a Servoy solution function call. scripting type: CustomType<aggrid-groupingtable.functionCall>
alias
Alias for the function call.
f
The function reference to execute.
Grid configuration options. scripting type: CustomType<aggrid-groupingtable.gridConfig>
enableColResize
Enables column resizing.
Default Value: true
enableSorting
Enables column sorting.
Default Value: true
groupUseEntireRow
When true, group rows span the entire row.
Default Value: true
Type definition for a grouped column. scripting type: CustomType<aggrid-groupingtable.groupedColumn>
columnid
Original column identifier associated with this group.
dataprovider
Data provider for the grouped column.
format
Format pattern for the grouped column.
id
Unique identifier for the grouped column.
styleClassDataprovider
Calculation to conditionally set CSS classes for the group.
valuelist
Value list for mapping grouped column data.
Type definition for a hashed foundset. scripting type: CustomType<aggrid-groupingtable.hashedFoundset>
columns
Column configuration for the foundset.
foundset
The foundset object reference.
foundsetUUID
Unique identifier for the foundset.
uuid
Unique hash identifier.
Icon configuration for various grid features. scripting type: CustomType<aggrid-groupingtable.iconConfig>
iconCheckboxChecked
Icon for a checked checkbox.
iconCheckboxCheckedReadOnly
Icon for a read-only checked checkbox.
iconCheckboxIndeterminate
Icon for an indeterminate checkbox.
iconCheckboxIndeterminateReadOnly
Icon for a read-only indeterminate checkbox.
iconCheckboxUnchecked
Icon for an unchecked checkbox.
iconCheckboxUncheckedReadOnly
Icon for a read-only unchecked checkbox.
iconClipboardCopy
Icon for copying to the clipboard.
iconClipboardPaste
Icon for pasting from the clipboard.
iconColumnGroupClosed
Icon for a closed column group.
iconColumnGroupOpened
Icon for an open column group.
iconColumnMoveAdd
Icon for adding a column.
iconColumnMoveGroup
Icon for grouping a column.
iconColumnMoveHide
Icon for hiding a column.
iconColumnMoveLeft
Icon for moving a column to the left.
iconColumnMoveMove
Icon for moving a column.
iconColumnMovePin
Icon for pinning a column.
iconColumnMovePivot
Icon for pivoting a column.
iconColumnMoveRight
Icon for moving a column to the right.
iconColumnMoveValue
Icon for moving a column's value.
iconColumnSelectClosed
Icon for closed column selection.
iconColumnSelectOpen
Icon for open column selection.
iconColumns
Icon for the columns panel.
iconDropNotAllowed
Icon indicating drop is not allowed.
iconEditorChecked
Icon for a checked editor state.
iconEditorUnchecked
Icon for an unchecked editor state.
iconFilter
Icon for filtering.
iconGroupContracted
Icon indicating a contracted group.
iconGroupExpanded
Icon indicating an expanded group.
iconMenu
Icon for the menu.
iconMenuAddRowGroup
Icon for adding a row group via the menu.
iconMenuPin
Icon for pinning in the header menu.
iconMenuRemoveRowGroup
Icon for removing a row group via the menu.
iconMenuValue
Icon for displaying values in the header menu.
iconPivotPanel
Icon for the pivot panel.
iconRefreshData
Icon for refreshing data.
iconRowGroupPanel
Icon for the row group panel.
iconSortAscending
Icon for ascending sort.
iconSortDescending
Icon for descending sort.
iconSortUnSort
Icon for unsorted state.
iconValuePanel
Icon for the value panel.
Configuration options for main menu items. scripting type: CustomType<aggrid-groupingtable.mainMenuItemsConfig>
autoSizeAll
Option to auto-size all columns.
Default Value: false
autoSizeThis
Option to auto-size the current column.
Default Value: false
contractAll
Option to contract all groups.
Default Value: false
expandAll
Option to expand all groups.
Default Value: false
pinSubMenu
Configuration for the pin sub-menu.
Default Value: false
resetColumns
Option to reset columns to default.
Default Value: false
rowGroup
Option to group rows by this column.
Default Value: true
rowUnGroup
Option to ungroup rows.
Default Value: true
valueAggSubMenu
Configuration for the value aggregation sub-menu.
Default Value: false
Configuration options for the ag‑grid tool panel. scripting type: CustomType<aggrid-groupingtable.toolPanelConfig>
suppressColumnExpandAll
Suppress the "expand all" option in the tool panel.
Default Value: false
suppressColumnFilter
Suppress the column filter in the tool panel.
Default Value: false
suppressColumnSelectAll
Suppress the "select all" option in the tool panel.
Default Value: false
suppressRowGroups
Suppress row groups in the tool panel.
Default Value: false
suppressSideButtons
Suppress side buttons in the tool panel.
Default Value: false
Type definition for a view column. scripting type: CustomType<aggrid-groupingtable.viewColumn>
colId
Unique identifier for the view column.
hide
When true, the column is hidden.
rowGroup
Indicates if the column is used for grouping.
rowGroupIndex
Grouping order index.
sort
Sorting order (e.g., asc, desc).
sortIndex
Index for multi-column sorting.
width
Width of the view column.
Apply 'columnsAutoSizing' for these events even if 'continuousColumnsAutoSizing' is false Type:
Apply 'columnsAutoSizing' whenever columns width are changed Type: Default Value: false
Menu items to append to the columns menu, beside the default aggrid menus. Type:
Determines whether the focus should move to the next cell when Enter is pressed. Type: Default Value: false
If moving of columns is enabled Type: Default Value: true
Allow the user to resize columns Type: Default Value: true
Enable column sorting by clickin on the column's header Type: Default Value: true
Flag indicating if the grid is enabled for user interaction. Type: Default Value: true
Map where additional grid properties of ag-grid can be set Type:
When true the group has checkbox for selecting/unselecting all child rows Type: Default Value: false
When true the group takes the entire row Type: Default Value: true
Custom icon configuration for grid features (e.g., sort, filter, group icons). Type:
Map where locales of ag-grid can be set Type:
Configuration for main menu items (customizes options like column pinning, sorting, etc.). Type:
The foundset where data are fetched from Type: Default Value: {"foundsetSelector":""}
Called when row(s) drag-n-drop is started, to get the drag image as an html code. Type:
Callback when dragging over a row - returns one of the strings: 'copy', 'move', 'none' depending on the allowed drag operation. Type:
Flag indicating if the grid is in read‑only mode, disabling editing. Type: Default Value: false
Table's height to be set in a responsive form. When responsiveHeight is set to 0, the table will use 100% height of the parent container. When responsiveHeight is set to -1, the table will auto-size it's height to the number of rows displayed inside the grid - in this case there is no vertical scrollbar and all rows are rendered Type: Default Value: 300
The height in pixels of the table's rows Type: Default Value: 25
Use dataSource calculation as rowStyleClassDataprovider to set styleClass conditionally to rows. The calculation should return the class name (or names) to be applied to the row Type:
If the column selection panel should be shown in the column menu Type: Default Value: false
When true the number of rows for groups is shown, beside the name Type: Default Value: false
When true, shows a loading indicator while data is being fetched or refreshed. Type: Default Value: true
CSS class for the cell. Type: Default Value: "ag-theme-alpine"
Tab sequence index used for keyboard navigation in the grid. Type:
Configuration object for the ag‑grid tool panel (e.g., which panels to show, button behavior). Type:
Tooltip text shown when hovering the refresh button Type: Default Value: "Refresh for latest data !"
Controls the visibility of the grid component. Type:
{} foundsetindex - The index of the clicked row in the foundset (or -1 for grouped rows).
{} columnindex - The index of the clicked column in the grid.
{} record - The record object corresponding to the clicked row. (Optional)
{} [event] - The event object associated with the click. (Optional)
{} [dataTarget] - Optional identifier indicating the target data context. (Optional)
{} foundsetindex - The index of the double-clicked row in the foundset (or -1 for grouped rows).
{} [columnindex] - The index of the double-clicked column in the grid. (Optional)
{} [record] - The record object corresponding to the double-clicked row. (Optional)
{} [event] - The event object associated with the double-click. (Optional)
{} [dataTarget] - Optional identifier indicating the target data context. (Optional)
{} foundsetindex - The index of the row where the right-click occurred (or -1 for grouped rows).
{} [columnindex] - The index of the right-clicked column in the grid. (Optional)
{} [record] - The record object corresponding to the right-clicked row. (Optional)
{} [event] - The event object associated with the right-click. (Optional)
{} [dataTarget] - Optional identifier indicating the target data context. (Optional)
{} foundsetindex The index of the row that changed (1-based).
{} [columnindex] The index of the column that changed (0-based).
{} [oldvalue] The previous value of the cell.
{} [newvalue] The new value of the cell.
{} [event] The event object associated with the data change.
{} [record] The record object representing the changed row.
Returns: {}
{} [foundsetindex] The row index where editing starts.
{} [columnindex] The column index where editing starts.
{} [value] The initial value of the cell being edited.
{} columnState The new serialized state of the columns (e.g., widths, order, visibility).
{} [event] The event object triggering the state change.
{} menuItemName The name of the custom menu item that was selected.
{} colId The column identifier associated with the menu action.
{} sourceRows An Array of JSRecord objects if dragged from a data grid, or plain objects if from a power grid
{} targetRecord The target record where the rows were dropped.
{} event The event object associated with the drop action.
{} [columnindex] The index of the footer cell that was clicked.
{} [event] The event object associated with the click.
{} [dataTarget] Optional identifier indicating the target data context of the click.
{} [groupcolumnindexes] An array of column indexes associated with the group.
{} [groupkeys] An array of keys representing the group hierarchy.
{} [isopened] True if the group is opened; false if closed.
{} [isgroupselection] Indicates if the selection change pertains to a group row.
{} [groupcolumnid] The ID of the column used for grouping, if applicable.
{} [groupkey] The key identifying the group whose selection has changed.
{} [groupselection] True if the entire group is selected; false if deselected.
{} [columnindexes] An array of column indexes that have been sorted.
{} [sorts] An array of sort orders (e.g., 'asc', 'desc') corresponding to the sorted columns.
{} alias Name used in params.context.componentParent.executeFunctionCall to call the function
{} f The Servoy solution function
{} foundsetindex Foundset row index of the editing cell (1-based)
{} columnindex Column index in the model of the editing cell (0-based)
Returns: The selected headers or groups. Each object has the following structure: - `colId` (String): The identifier of the column. - `groupkey` (String, optional): The key of the group (not included for headers).
{} index Index between 0 and columns length -1
Returns: The column object at the specified index.
{} colId Id of the column
Returns: The column object corresponding to the provided id.
{} colId The unique identifier of the column whose index is to be retrieved.
Returns: The 0-based index of the column corresponding to the given column id, or -1 if the column id is not found.
Returns: The current state of the columns as a JSON string for restoring the state.
Returns: The total number of columns in the specified element.
Returns: An object representing the currently expanded groups, where each key is a group name, and its value is an object detailing any expanded subgroups.
Returns: An array of JSRecord objects representing the selected rows in grouping mode.
{} colId - The unique identifier of the column.
Returns: The view column object corresponding to the specified column ID.
Returns: An array of view column objects representing the columns currently displayed.
Returns: `true` if the ToolPanel is showing otherwise `false`
{} id Column id
{} index New position (0-based)
{} dataprovider Dataprovider of the column
{} [index] Index between 0 and columns length
Returns: The newly created column object at the specified index with the given dataprovider.
Returns: True if all columns were successfully removed; otherwise, false.
{} index Index between 0 and columns length -1
Returns: True if the column was successfully removed, false otherwise.
{} columnindex Column index in the model of the editing cell (0-based)
{} [columnState] A JSON string representing the saved state of the columns, including width, position, visibility, filters, and sorting. If omitted, the columns will be restored to their design-time state.
{} [onError] A callback function to handle errors during the restore process, such as mismatched column configurations.
{} [columns] Specifies whether to restore the columns' size, position, and visibility. Defaults to true.
{} [filter] Specifies whether to restore the columns' filter state. Defaults to false.
{} [sort] Specifies whether to restore the columns' sort state. Defaults to false.
{} groups The selected headers or groups. Each object should have the following structure: - `colId` (String): The identifier of the column. - `groupkey` (String, optional): The key of the group (not included for headers).
{} groups An object like {expandedGroupName1:{}, expandedGroupName2:{expandedSubGroupName2_1:{}, expandedSubGroupName2_2:{}}}
{} filterModel The filter model object defining the filtering criteria for the grid. Each key represents a column's id, and its value specifies the filter configuration, including filter type, conditions, and operator. To clear all filters, pass an empty object ({} ).
{} value Form editor value
{} selectedRecords Form editor value
{} readonly Read-only state
{} [columnids] Array of column ids to make ready-only
{} show A flag indicating whether to show (true) or hide (false) the ToolPanel in the Servoy component.
{} [cancel] 'true' to cancel the editing (ie don't accept changes)
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type:
Type: