diff options
Diffstat (limited to 'ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-cell-editor/rdp-select-editor/rdp-select-editor.component.ts')
-rw-r--r-- | ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-cell-editor/rdp-select-editor/rdp-select-editor.component.ts | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-cell-editor/rdp-select-editor/rdp-select-editor.component.ts b/ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-cell-editor/rdp-select-editor/rdp-select-editor.component.ts new file mode 100644 index 00000000..a657a000 --- /dev/null +++ b/ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-cell-editor/rdp-select-editor/rdp-select-editor.component.ts @@ -0,0 +1,43 @@ +import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core'; + +@Component({ + selector: 'rdp-select-editor', + styleUrls: ['./rdp-select-editor.component.scss'], + template: ` + <mat-select [(value)]="selected" + (selectionChange)="detectChange(columnValue)"> + <mat-option *ngFor="let item of data" [value]="item.name"> + {{item.name}} + </mat-option> + </mat-select> + ` +}) +export class RdpSelectEditorComponent implements OnInit { + + @Input() rowdata: any; + @Input() columntitle: any; + @Input() data: any[]; + @Output() changedColumnValue = new EventEmitter<any>(); + selected: any; + columnValue: any; + + constructor() { } + + ngOnInit() { + if (this.rowdata != null || this.rowdata != undefined) { + let rowObj = JSON.parse(this.rowdata); + let column = this.columntitle; + this.columnValue = rowObj[column]; + + } else { + this.columnValue = null; + } + this.selected = this.columnValue; + console.log(" this.selected :::", this.selected); + } + + detectChange(changedValue) { + this.changedColumnValue.emit(changedValue); + } + +} |