// Optional: add a function that returns true or false.
// If true, this action will be disabled; if false
// (default behavior), the action will be enabled.
- @Input() disabled: (rows: any[]) => boolean;
+ @Input() disableOnRows: (rows: any[]) => boolean;
// get a reference to our container grid.
constructor(@Host() private grid: GridComponent) {}
action.label = this.label;
action.action = this.action;
- action.disabled = (this.disabled == null) ? (rows: any[]) => false : this.disabled;
-
+ action.disableOnRows = (this.disableOnRows === null) ?
+ (rows: any[]) => false : this.disableOnRows;
this.grid.context.toolbarActions.push(action);
}
}
shouldDisableAction(action: GridToolbarAction) {
- return action.disabled(this.gridContext.getSelectedRows());
+ return action.disableOnRows(this.gridContext.getSelectedRows());
}
printHtml() {
export class GridToolbarAction {
label: string;
action: (rows: any[]) => any;
- disabled: (rows: any[]) => boolean;
+ disableOnRows: (rows: any[]) => boolean;
}
// Buttons are global actions
[rowFlairCallback]="btGridRowFlairCallback"
[cellClassCallback]="btGridCellClassCallback"
[sortable]="true">
- <eg-grid-toolbar-action label="Action that needs a single row" i18n-label [action]="complimentEvergreen" [disabled]="notOneSelectedRow">
+ <eg-grid-toolbar-action label="Action that needs a single row" i18n-label
+ [action]="complimentEvergreen" [disableOnRows]="notOneSelectedRow">
</eg-grid-toolbar-action>
<eg-grid-column name="test" [cellTemplate]="cellTmpl"
[cellContext]="btGridTestContext" [sortable]="false">