1 import {Component, Input, OnInit, Host, Output, EventEmitter} 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 @Output() onChange: EventEmitter<boolean>;
20 // get a reference to our container grid.
21 constructor(@Host() private grid: GridComponent) {
22 this.onChange = new EventEmitter<boolean>();
28 console.warn('GridToolbarCheckboxComponent needs a [grid]');
32 const cb = new GridToolbarCheckbox();
33 cb.label = this.label;
34 cb.onChange = this.onChange;
36 this.grid.context.toolbarCheckboxes.push(cb);