Actions and Selections
Grid Control 3.0
Actions and Selections
Use these features to control column actions and row selections in grids:
Column Actions
You can specify actions for specific columns. When you do so for a column that has a corresponding data source field, cells in that column display field values as hyperlinks. If the column has no corresponding data source field, cells in that column display a button. The column title is the button text.
When you click in an action, the control calls the action listener function.
Add-in Manager API
To specify an action listener for a column in JavaScript code:
var grid = View.createControl({ control: 'DataGrid', ... columns: [{ id: 'approve', title: 'Approve', listener: function(row, cell) { ... code ... } }, ... other columns ... ] });
Grid control passes these parameters to the listener function:
Parameter Name | Parameter Type | Comment |
---|---|---|
row | Ab.grid.Row |
Defined in
The
|
Example view: http://localhost:8080/archibus/schema/ab-products/solutions/parts/grid/ab-ex-advanced-grid-categories.axvw
Single Row Selection
You can specify an event listener for single row selection. When you do so, users can click any cell in the row - except cells that have column actions - to trigger the event. When you click in the row, the control:
- Clears highlight from previously selected row
- Highlights selected row
- Calls event listener function for selected row
If you refresh, filter, or sort the grid, or navigate to a different page, the row is no longer selected. You must reselect the row to trigger another single-selection event.
Add-in Manager API
To specify an event listener for single row selection in JavaScript code:
var grid = View.createControl({ control: 'DataGrid', ... events: { onClickItem: function(row) { ... code ... } } });
The control passes the following parameter to the listener function:
Parameter Name | Parameter Type |
---|---|
row | Ab.grid.Row |
Multiple Row Selection
You can specify an event listener for multiple row selection. When you enable multiple row selection, the grid displays check boxes for all rows. When users click any checkbox, the control selects or unselects the row. The control calls the listener function for all selected rows.
If you refresh, filter, or sort the grid, or navigate to a different page, the grid remembers previous selections, and displays checkmarks for selected rows.
Add-in Manager API
To specify an event listener for multiple row selection in JavaScript code:
var grid = View.createControl({ control: 'DataGrid', ... multipleSelectionEnabled: true, events: { onMultipleSelectionChange: function(row, selected) { ... code ... } } });
The control passes the following parameters to the listener function:
Parameter Name | Parameter Type | Comment |
---|---|---|
row | Ab.grid.Row | |
selected | boolean | True if the row is selected, false if the row is not selected. |
Use these JavaScript API methods to work with multiple selection of rows in a grid:
Method |
Parameters |
Return value |
Description |
---|---|---|---|
Methods that handle multiple row selection on the current page |
|||
getSelectedRows |
None |
Array of Object |
Returns all currently selected row data objects on the current page. Each object contains data values in this format: { 'wr.wr_id': value, 'wr.status': value, ... } |
getSelectedRecords |
None |
Array of Ab.data.Record objects |
Returns data records for all currently selected rows on the current page. |
Methods that handle multiple row selection across multiple pages |
|||
getAllSelectedRows |
None |
Array of Object |
Returns all currently selected row data objects on all pages. Each object contains data values in this format: { 'wr.wr_id': value, 'wr.status': value, ... } |
getAllSelectedRecords |
None |
Array of Ab.data.Record objects |
Returns data records for all currently selected rows on all pages. |
selectAll |
selected: boolean |
None |
Selects
or un-selects all rows on all pages.
Triggers the
|
unselectAll |
None |
None |
Un-selects
all rows on all pages.
Triggers the
|
clearAllSelected |
None |
None |
Clears all selections across all pages. |
Example view: http://localhost:8080/archibus/schema/ab-products/solutions/parts/grid/ab-ex-advanced-grid-categories.axvw