1 import {Component, Input, OnInit, Host, TemplateRef} from '@angular/core';
2 import {GridToolbarCheckbox} from './grid';
3 import {GridComponent} from './grid.component';
6 selector: 'eg-grid-toolbar-checkbox',
7 template: '<ng-template></ng-template>'
10 export class GridToolbarCheckboxComponent implements OnInit {
12 // Note most input fields should match class fields for GridColumn
13 @Input() label: string;
15 // This is an input instead of an Output because the handler is
16 // passed off to the grid context for maintenance -- events
17 // are not fired directly from this component.
18 @Input() onChange: (checked: boolean) => void;
20 // get a reference to our container grid.
21 constructor(@Host() private grid: GridComponent) {}
26 console.warn('GridToolbarCheckboxComponent needs a [grid]');
30 const cb = new GridToolbarCheckbox();
31 cb.label = this.label;
32 cb.onChange = this.onChange;
34 this.grid.context.toolbarCheckboxes.push(cb);