// (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) {}
const action = new GridToolbarAction();
action.label = this.label;
action.action = this.action;
+ action.separator = this.separator;
action.disableOnRows = this.disableOnRows;
this.grid.context.toolbarActions.push(action);
class="material-icons mat-icon-in-button">playlist_add_check</span>
</button>
<div class="dropdown-menu" ngbDropdownMenu>
- <button class="dropdown-item" (click)="performAction(action)"
- *ngFor="let action of gridContext.toolbarActions"
- [disabled]="shouldDisableAction(action)">
- <span class="ml-2">{{action.label}}</span>
- </button>
+ <ng-container *ngFor="let action of gridContext.toolbarActions">
+ <ng-container *ngIf="action.separator">
+ <div class="dropdown-divider"></div>
+ </ng-container>
+ <ng-container *ngIf="!action.separator">
+ <a class="dropdown-item" (click)="performAction(action)"
+ [disabled]="shouldDisableAction(action)">
+ <span class="ml-2">{{action.label}}</span>
+ </a>
+ </ng-container>
+ </ng-container>
</div>
</div>
// Actions apply to specific rows
export class GridToolbarAction {
label: string;
+ separator: boolean;
action: (rows: any[]) => any;
disableOnRows: (rows: any[]) => boolean;
}