ActionColumn
A column that displays actions as clickable icons in the cell.
new TreeGrid({
appendTo : document.body,
columns : [{
type : 'action',
text : 'Increase amount',
actions : [{
cls : 'fa fa-plus',
renderer : ({ action, record }) => `<i class="b-action-item ${action.cls} b-${record.enabled ? "green" : "red"}-class"></i>`,
visible : ({ record }) => record.canAdd,
tooltip : ({ record }) => `<p class="b-nicer-than-default">Add to ${record.name}</p>`,
onClick : ({ record }) => console.log(`Adding ${record.name}`)
}, {
cls : 'fa fa-pencil',
tooltip : 'Edit note',
onClick : ({ record }) => console.log(`Editing ${record.name}`)
}]
}]
});
Actions may be placed in Group headers, by setting action.showForGroup to true. Those actions will not be shown on normal rows.
Accessibility
If ariaLabel is omitted, adding a tooltip to an action will automatically set this as the aria-label for the button element. Use ariaHasPopup to indicate that the action triggers a popup, helping assistive technology users understand the interaction behavior.
Useful configs
| Config | Description |
|---|---|
| actions | Array of action icon configs |
| disableIfGridReadOnly | Disable actions in read-only mode |
See also
Configs
Configs are options you supply in a configuration object when creating an instance of this class-
Set to
trueto disable actions in this column if the grid is readOnlyHas a corresponding runtime disableIfGridReadOnly property.
-
Column minimal width. If value is Number then minimal width is in pixels.
Has a corresponding runtime minWidth property.
Properties
Properties are getters/setters or publicly accessible variables on this class-
Identifies an object as an instance of ActionColumn class, or subclass thereof.
-
Set to
trueto disable actions in this column if the grid is readOnlyHas a corresponding disableIfGridReadOnly config.
-
Identifies an object as an instance of ActionColumn class, or subclass thereof.
-
Column minimal width. If value is Number then minimal width is in pixels.
Has a corresponding minWidth config.
Functions
Functions are methods available for calling on the class-
defaultRenderer( )private
Renderer that displays action icon(s) in the cell.
-
onCellClick( )private
Handle icon click and call action handler.
-
Update width for actions column to fit content.
Type definitions
CSS variables
CSS variables that can be set to adjust appearance| Name | Description | |
|---|---|---|
| --b-action-column-button-size | Button size (applied as font-size) | |
| --b-action-column-color | Button color | |
| --b-action-column-row-hover-color | Button color when row is hovered or selected | |
| Hovered | ||
| --b-action-column-hover-color | Button color when hovered | |
| Readonly | ||
| --b-action-column-readonly-color | Button color when readonly | |