Angular TreeList - columns.buttons
Allows you to customize buttons in the editing column or create a custom command column. Applies only if the column's type is "buttons".
icon
This option accepts one of the following:
- The icon's URL
- The icon's name if the icon is from the DevExtreme icon library
- The icon's CSS class if the icon is from an external icon library (see External Icon Libraries)
- The icon in the Base64 format
See Also
- buttons[].text
name
To configure a built-in button, assign its name to this option. The other options in the object configure the button. For example, the following code adds a custom CSS class to the Save button:
jQuery
$(function () { $("#treeListContainer").dxTreeList({ // ... columns: [{ type: "buttons", buttons: [{ name: "save", cssClass: "my-class" }] }] }); });
Angular
<dx-tree-list ... > <dxi-column type="buttons"> <dxi-button name="save" cssClass="my-class"> </dxi-button> </dxi-column> </dx-tree-list>
import { DxTreeListModule } from "devextreme-angular"; // ... export class AppComponent { // ... } @NgModule({ imports: [ // ... DxTreeListModule ], // ... })
onClick
Name | Type | Description |
---|---|---|
component |
The widget's instance. |
|
element |
The widget's container. It is an HTML Element or a jQuery Element when you use jQuery. |
|
model |
The model data. Available only if you use Knockout. |
|
event | Event (jQuery or EventObject) |
The event that caused the function's execution. It is a dxEvent or a jQuery.Event when you use jQuery. |
row |
The properties of the button's row. |
|
column |
The properties of the button's column. |
template
Name | Type | Description |
---|---|---|
component |
The widget's instance. |
|
data |
The data of the cell's row. |
|
key | any |
The row's key. |
columnIndex |
The index of the cell's column. |
|
column |
The column's properties. |
|
rowIndex |
The index of the cell's row. Begins with 0 on each page. Group rows are included. |
|
rowType |
The row's type. |
|
row |
The row's properties. |
visible
Name | Type | Description |
---|---|---|
component |
The widget's instance. |
|
row |
The row's properties. |
|
column |
The column's properties. |
Use the function when you need to show or hide the button for specific rows. For example, the widget lists online orders and allows users to edit them. A Cancel button should allow users to cancel their orders. However, completed orders should not be canceled. The visible function in this case may look as follows:
jQuery
$(function () { $("#treeListContainer").dxTreeList({ // ... columns: [{ type: "buttons", buttons: [{ text: "Cancel", visible: function (e) { return !e.row.isEditing && !e.row.data.isCompleted; } }] }] }); });
Angular
<dx-tree-list ... > <dxi-column type="buttons"> <dxi-button text="Cancel" [visible]="isCancelButtonVisible"> </dxi-button> </dxi-column> </dx-tree-list>
import { DxTreeListModule } from "devextreme-angular"; // ... export class AppComponent { isCancelButtonVisible (e) { return !e.row.isEditing && !e.row.data.isCompleted; } } @NgModule({ imports: [ // ... DxTreeListModule ], // ... })
If you have technical questions, please create a support ticket in the DevExpress Support Center.