I basically generating a table and populating it in my angular 7 application. What I am looking at is generating an additional column when the user clicks the Add Sideletter button as shown in the screenshot. For example it should create column next to column Class B. How could I go about doing this. I have add class button on the table and clicking it creates a record and it populates the table with last td containing new record. I now need that clicking the Add side letter button should create a column beside it.
Or another way I can think of creating an addition column along with the existing column and hiding it. Shoring it only when the Add side letter button is clicked.
I have added a fiddle https://jsfiddle.net/76w4zhnu/
html
<style>
th,
td {
padding: 7px;
min-width: 300px;
max-width: 300px;
}
.fundClassesTable {
table-layout: fixed;
}
.cellbgcolor {
color: transparent;
}
.btn {}
.tableItem {
text-align: center;
border-left: solid 1px lightgrey;
border-top: solid 1px lightgrey;
border-right: solid 1px lightgrey;
border-bottom: solid 1px lightgrey;
}
.rowItem:hover {
background-color: #f5f7f7;
}
label {
margin-left: 0.5rem;
vertical-align: middle
}
.panel-heading {
color: black;
/* background-color: #F59850; */
border-color: #ddd;
overflow: hidden;
padding-top: 5px !important;
padding-bottom: 5px !important;
}
.panel-heading .left-label {
display: inline-block;
padding-top: 5px !important;
}
.scrollClass {
overflow-x: scroll;
display: grid;
}
.panel-heading label {
margin-bottom: 0px !important;
}
</style>
<table class="fundClassesTable table-striped">
<tr *ngFor="let c of ColumnNames">
<ng-container *ngIf="c != ColumnNames[45] && c != ColumnNames[46] && c != ColumnNames[47] || isHurdle;">
<th
[ngClass]="c != ColumnNames[56] && c != ColumnNames[57] && c != ColumnNames[38]? 'tableItem bold' : 'tableItem cellbgcolor'">
{{ c }}</th>
<ng-container *ngFor="let f of LegalFundClasses.LegalFundClassDetailsViewModel; let i=index">
<td class="tableItem" *ngIf="c == ColumnNames[0]">{{f.Description}}</td>
<td class="tableItem" *ngIf="c == ColumnNames[1]">{{f.AuditSummary}}</td>
<td class="tableItem" *ngIf="c == ColumnNames[2]">{{f.Id}}</td>
<td class="tableItem" *ngIf="c == ColumnNames[3]">COMMERCIAL TERMS</td>
<td class="tableItem" *ngIf="c == ColumnNames[4]">
<div *ngIf="EditMode[f.Id]">
<button type="button" class="btn btn-default btn" style="float: left;"
(click)="reviewClicked(f.Id,1)">Review Terms</button>
<!-- <input kendoTextBox [(ngModel)]="f.AuditSummary" style="width: 100%; height: 29.5px;" />
<input kendoTextBox [(ngModel)]="f.AuditSummary" style="width: 100%; height: 29.5px;" /> -->
{{f.AuditSummary}}
</div>
</td>
<td colspan=i class="tableItem" *ngIf="c == ColumnNames[5] && i<1"></td>
<td *ngIf="!EditMode[f.Id] && c == ColumnNames[6]" class="tableItem"> {{f.PrimaryCurrencyName}}
</td>
<td *ngIf="EditMode[f.Id] && c == ColumnNames[6]" class="tableItem">
<kendo-dropdownlist style="height: 29.5px;" [(ngModel)]="f.CurrencyId"
[defaultItem]="defaultItem" class="form-control form-control-sm"
[data]="LegalFundClasses.Currencies" [filterable]="false" textField="Name"
[valuePrimitive]="true" valueField="Id">
</kendo-dropdownlist>
</td>
<td *ngIf="!EditMode[f.Id] && c == ColumnNames[7]" class="tableItem"> {{f.ManagerStrategyName}}
</td>
<td *ngIf="EditMode[f.Id] && c == ColumnNames[7]" class="tableItem">
<kendo-dropdownlist style="height: 29.5px;" [(ngModel)]="f.ManagerStrategyId"
[defaultItem]="defaultItem" class="form-control form-control-sm"
[data]="LegalFundClasses.ManagerStrategies" [filterable]="false" textField="Name"
[valuePrimitive]="true" valueField="Id">
</kendo-dropdownlist>
</td>
<td class="tableItem" *ngIf="c == ColumnNames[56]">
<div *ngIf="EditMode[f.Id]">
<div *ngIf="hideAdd">
<button type="button" class="btn btn-default btn mr-1" style="float: left;"
(click)="openSideLetterModal(f.Id,f.Description)">Add Side Letter</button>
</div>
<div *ngIf="hideDelete">
<button type="button" class="btn btn-default btn" style="float: left;"
(click)="deleteSideLetter()">Delete Side Letter</button>
</div>
</div>
</td>
</ng-container>
</ng-container>
</tr>
</table>
Component
Component
public ColumnNames: string[] = ['Legal Class Name',
'Last Edited',
'Legal Class ID',
'',
'TERMS',
'SUBSCRIPTIONS',
'Primary Currency',
'Manager Strategy (populate only if different from Fund Manager Strategy)'
'Space2'
];