1 import {Component, Input, OnInit, Host, TemplateRef} from '@angular/core';
2 import {GridToolbarAction} from './grid';
3 import {GridComponent} from './grid.component';
6 selector: 'eg-grid-toolbar-action',
7 template: '<ng-template></ng-template>'
10 export class GridToolbarActionComponent implements OnInit {
12 // Note most input fields should match class fields for GridColumn
13 @Input() label: string;
14 @Input() action: (rows: any[]) => any;
16 // get a reference to our container grid.
17 constructor(@Host() private grid: GridComponent) {}
22 console.warn('GridToolbarActionComponent needs a [grid]');
26 const action = new GridToolbarAction();
27 action.label = this.label;
28 action.action = this.action;
30 this.grid.context.toolbarActions.push(action);