Arun Jadhav преди 10 месеца
родител
ревизия
783b198eba
променени са 2 файла, в които са добавени 6 реда и са изтрити 11 реда
  1. +1
    -0
      src/app/pages/veriable-form/veriable-form.component.sass
  2. +5
    -11
      src/app/pages/veriable-form/veriable-form.component.ts

+ 1
- 0
src/app/pages/veriable-form/veriable-form.component.sass Целия файл

@@ -47,3 +47,4 @@

.row-section
padding: 20px
overflow-y: auto

+ 5
- 11
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]);
}


Loading…
Отказ
Запис