From 783b198eba76dbc84458e91d19b41d54f12bba84 Mon Sep 17 00:00:00 2001 From: Arun Jadhav Date: Wed, 25 Sep 2024 14:48:15 +0530 Subject: [PATCH] changes --- .../veriable-form/veriable-form.component.sass | 1 + .../veriable-form/veriable-form.component.ts | 16 +++++----------- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/src/app/pages/veriable-form/veriable-form.component.sass b/src/app/pages/veriable-form/veriable-form.component.sass index 287f5ac..efe3fad 100644 --- a/src/app/pages/veriable-form/veriable-form.component.sass +++ b/src/app/pages/veriable-form/veriable-form.component.sass @@ -47,3 +47,4 @@ .row-section padding: 20px + overflow-y: auto diff --git a/src/app/pages/veriable-form/veriable-form.component.ts b/src/app/pages/veriable-form/veriable-form.component.ts index c080e2f..f32e7e9 100644 --- a/src/app/pages/veriable-form/veriable-form.component.ts +++ b/src/app/pages/veriable-form/veriable-form.component.ts @@ -12,9 +12,6 @@ import { ApiService } from 'src/app/_services'; }) export class VeriableFormComponent implements OnInit { form: FormGroup; - - // Sample variable list for dropdown - variableList = ['Variable 1', 'Variable 2', 'Variable 3']; public componentDestroyed = new Subject(); rdsValues: any; selectedParamValue: any = {}; @@ -22,7 +19,7 @@ export class VeriableFormComponent implements OnInit { constructor(private fb: FormBuilder, private api: ApiService) { this.form = this.fb.group({ - rows: this.fb.array([]) // Form array for multiple rows + rows: this.fb.array([]) }); } @@ -52,9 +49,9 @@ export class VeriableFormComponent implements OnInit { createColumn(): FormGroup { return this.fb.group({ - type: [''], // Type can be 'text' or 'variable' - textValue: [''], // For text input - variableValue: [''] // For variable select + type: [''], + textValue: [''], + variableValue: [''] }); } @@ -65,7 +62,7 @@ export class VeriableFormComponent implements OnInit { addRow(): void { const row = this.fb.group({ - columns: this.fb.array([this.createColumn()]) // Initialize with one column + columns: this.fb.array([this.createColumn()]) }); this.rows.push(row); } @@ -85,16 +82,13 @@ export class VeriableFormComponent implements OnInit { for (let item of this.rdsValues.modbus) { if (item.hasOwnProperty(selectedParam)) { - // Initialize the row if not present if (!this.selectedParamValue[rowIndex]) { this.selectedParamValue[rowIndex] = {}; } - // Assign the selected param value to the specific row and column this.selectedParamValue[rowIndex][colIndex] = item[selectedParam]; break; } } - this.inputValue = this.selectedParamValue[rowIndex][colIndex] console.log(`Row: ${rowIndex}, Column: ${colIndex}, Value:`, this.selectedParamValue[rowIndex][colIndex]); }