import { Component, ViewContainerRef, ViewChild, AfterViewInit } from '@angular/core'; import { AgEditorComponent } from 'ag-grid-ng2/main'; import { RegionSelectList } from '../models/regionselectlist'; @Component({ selector: 'editor-cell', template: `

{{item.name}}

` }) export class EditorComponent implements AgEditorComponent, AfterViewInit { @ViewChild('container', {read: ViewContainerRef}) public container; public item: any; public data: RegionSelectList[]; private params: any; ngAfterViewInit() { this.container.element.nativeElement.focus(); } agInit(params: any): void { this.params = params; this.data = params.data || []; // this.setHappy(params.value === "Happy"); } getValue(): any { return this.item; } isPopup(): boolean { return true; } setValue(item: any): void { this.item = item; } onClick(item: any) { this.setValue(item); this.params.api.stopEditing(); } onKeyDown(event): boolean { event.stopPropagation(); return false; } }