You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
1.1 KiB
44 lines
1.1 KiB
import {ICellEditorAngularComp} from 'ag-grid-angular';
|
|
import {AfterViewInit, Component, ElementRef, ViewChild} from '@angular/core';
|
|
import {ICellEditorParams} from 'ag-grid-community';
|
|
|
|
@Component({
|
|
selector: 'cell-editor-paragraph',
|
|
template: `<input #input [(ngModel)]="value" readonly (click)="onClick()">`,
|
|
styles: [
|
|
`input {
|
|
width: 100%;
|
|
border: 1px solid grey;
|
|
}`
|
|
],
|
|
})
|
|
export class BooleanEditorComponent implements ICellEditorAngularComp, AfterViewInit {
|
|
private params: ICellEditorParams;
|
|
public value: string;
|
|
|
|
@ViewChild('input', {static: false}) input: ElementRef;
|
|
|
|
agInit(params: ICellEditorParams): void {
|
|
this.params = params;
|
|
this.value = this.params.value;
|
|
}
|
|
|
|
getValue(): any {
|
|
return this.value;
|
|
}
|
|
|
|
ngAfterViewInit(): void {
|
|
this.onClick();
|
|
}
|
|
|
|
onClick() {
|
|
if ( this.value === 'True' ) {
|
|
this.value = 'False';
|
|
} else if ( this.value === 'False' ) {
|
|
this.value = '';
|
|
} else {
|
|
this.value = 'True';
|
|
}
|
|
}
|
|
}
|