changes
This commit is contained in:
@@ -47,3 +47,4 @@
|
||||
|
||||
.row-section
|
||||
padding: 20px
|
||||
overflow-y: auto
|
||||
|
||||
@@ -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]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user