parent
1bd3795a4a
commit
7916c7966f
@ -0,0 +1,6 @@
|
|||||||
|
.column-def {
|
||||||
|
border: 2px solid #ccc;
|
||||||
|
margin: 5px;
|
||||||
|
padding: 5px;
|
||||||
|
border-radius: 7px;
|
||||||
|
}
|
@ -0,0 +1,41 @@
|
|||||||
|
import {ICellEditorAngularComp} from 'ag-grid-angular';
|
||||||
|
import {AfterViewInit, Component, ElementRef, ViewChild} from '@angular/core';
|
||||||
|
import {ICellEditorParams} from 'ag-grid-community';
|
||||||
|
import {IonSelect} from '@ionic/angular';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'cell-editor-paragraph',
|
||||||
|
template: `
|
||||||
|
<ion-select #select [(ngModel)]="value" style="padding: 0;"
|
||||||
|
[interfaceOptions]="{header: params.colDef.headerName, cssClass: 'big-alert'}">
|
||||||
|
<ion-select-option *ngFor="let option of options" [value]="option.value">{{ option.value }}</ion-select-option>
|
||||||
|
</ion-select>
|
||||||
|
`,
|
||||||
|
styles: [
|
||||||
|
`input {
|
||||||
|
width: 100%;
|
||||||
|
border: 1px solid grey;
|
||||||
|
}`
|
||||||
|
],
|
||||||
|
})
|
||||||
|
export class SelectEditorComponent implements ICellEditorAngularComp, AfterViewInit {
|
||||||
|
private params: ICellEditorParams;
|
||||||
|
public value: string;
|
||||||
|
public options: Array<{value: string}> = [];
|
||||||
|
@ViewChild('select', {static: false}) select: IonSelect;
|
||||||
|
|
||||||
|
agInit(params: ICellEditorParams): void {
|
||||||
|
this.params = params;
|
||||||
|
this.value = this.params.value;
|
||||||
|
// @ts-ignore
|
||||||
|
this.options = this.params.colDef.additionalData.options;
|
||||||
|
}
|
||||||
|
|
||||||
|
getValue(): any {
|
||||||
|
return this.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
ngAfterViewInit(): void {
|
||||||
|
this.select.open();
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in new issue