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.
34 lines
1.1 KiB
34 lines
1.1 KiB
import {ICellEditorAngularComp} from 'ag-grid-angular';
|
|
import {AfterViewInit, Component, ViewChild} from '@angular/core';
|
|
import {ICellEditorParams} from 'ag-grid-community';
|
|
import {IonDatetime} from '@ionic/angular';
|
|
|
|
@Component({
|
|
selector: 'cell-editor-select',
|
|
template: `<ion-datetime #picker [displayFormat]="format" [(ngModel)]="value" style="padding: 0 0 0 5px;"></ion-datetime>`,
|
|
})
|
|
export class DatetimeEditorComponent implements ICellEditorAngularComp, AfterViewInit {
|
|
public params: ICellEditorParams;
|
|
public value: string;
|
|
public format = 'YYYY-MM-DD h:mm a';
|
|
@ViewChild('picker', {static: false}) picker: IonDatetime;
|
|
|
|
agInit(params: ICellEditorParams): void {
|
|
this.params = params;
|
|
this.value = this.params.value;
|
|
// @ts-ignore
|
|
if ( this.params.colDef.additionalData.format ) {
|
|
// @ts-ignore
|
|
this.format = this.params.colDef.additionalData.format;
|
|
}
|
|
}
|
|
|
|
getValue(): any {
|
|
return this.value;
|
|
}
|
|
|
|
ngAfterViewInit(): void {
|
|
this.picker.open();
|
|
}
|
|
}
|