I have an object that lists the tables and columns of a database, with a checkbox and a drop-down to modify it, I want to save that object but with the check and the modified drop-down when I click on a button.
The html:
<div class="card" *ngFor="let table of schema.tables | keyvalue">
<div class="card-header border-top headerCollapse p-0" [attr.id]="'heading' + table.key">
<h5 class="mb-0">
<button class="collapsed AccodeonTitle activeAccodeonTitle" data-toggle="collapse" [attr.data-target]="'#collapse' + table.key" aria-expanded="false" [attr.aria-controls]="'#collapse' + table.key">
<span>{{table.value.name}}</span>
</button>
</h5>
<svg data-toggle="collapse" [attr.data-target]="'#collapse' + table.key" width="1em" height="1em" viewBox="0 0 16 16" class="bi bi-chevron-up collapseIcon collapseIconActive" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" d="M7.646 4.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1-.708.708L8 5.707l-5.646 5.647a.5.5 0 0 1-.708-.708l6-6z"/>
</svg>
</div>
<div [attr.id]="'collapse' + table.key" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion">
<div class="card-body p-0">
<table class="ConfigurationTable selectTable pl-5">
<thead class="theadSelectTable">
<tr>
<th>
<div class="d-flex align-items-center">
<span class="colLogo"></span>
<span class="d-inline-block pl-3">Columnas</span>
</div>
</th>
<th></th>
</tr>
</thead>
<tbody class="">
<tr *ngFor="let column of table.value.columns | keyvalue">
<td>
<input (click)="alert($event)" type="checkbox" aria-label="Checkbox for following text input">
<span class="pl-3">{{column.value.name}}</span>
</td>
<td class="selectProperties">
<select class="custom-select customPlaceHolder tablePlaceHolder custom-select-table">
<option selected>Base de datos_06</option>
<option value="1">PER</option>
<option value="2">NUM</option>
<option value="3">DATA</option>
</select>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
the Object:
export interface SchemeDB {
name:String;
tables:Map<String,Table>;
}
export interface Table {
name:String;
columns:Map<String,Column>;
}
export interface Column {
checked:boolean;
typeEnt:String
name:String;
type:String;
size:number;
primaryKey:boolean;
}
I need to modify the variable checked and typeEnt of the Column interface
You can create an array and push the column into the array on checking it
In the html you can give
So while saving you have all the columns that are checked.