// (default behavior), the action will be enabled.
@Input() disableOnRows: (rows: any[]) => boolean;
+ // If true, render a separator bar only, no action link.
+ @Input() separator: boolean;
// get a reference to our container grid.
- constructor(@Host() private grid: GridComponent) {
- this.onClick = new EventEmitter<any []>();
- }
+ constructor(@Host() private grid: GridComponent) { }
ngOnInit() {
const action = new GridToolbarAction();
action.label = this.label;
action.action = this.action;
- action.onClick = this.onClick;
action.group = this.group;
+ action.separator = this.separator;
action.disableOnRows = this.disableOnRows;
+
+ if (!this.separator) {
+ action.onClick = this.onClick = new EventEmitter<any []>();
+ }
+
this.grid.context.toolbarActions.push(action);
}
}
<ng-container *ngIf="action.isGroup">
<span class="ml-2 font-weight-bold font-italic">{{action.label}}</span>
</ng-container>
+ <ng-container *ngIf="action.separator">
+ <div class="dropdown-divider"></div>
+ </ng-container>
<ng-container *ngIf="action.group && !action.isGroup">
<!-- grouped entries are indented -->
<span class="ml-4">{{action.label}}</span>
</ng-container>
- <ng-container *ngIf="!action.group && !action.isGroup">
+ <ng-container
+ *ngIf="!action.group && !action.isGroup && !action.separator">
<span class="ml-2">{{action.label}}</span>
</ng-container>
</button>