ng2-table
ng2-table copied to clipboard
Add / remove cols dynamically
Hi, I am meeting a problem about adding/removing columns dynamically... I update the columns variable, but the cols are still displayed in the table....
Quentin
Hey, If you are trying to update the columns at runtime then make sure that after updating columns you must call onChangeTableFunction
this.onChangeTable(this.config);
According to its functionality it will rerender html. It will works for you I hope
do you have any update on this.
Doesn't work for me..
Nope - doesn't work for me either
Did you solve this?
No - I replaced it with ngPrime data table.
maybe in 2022
Dummy workarond:
<div *ngIf="columns.length == 9">
<ng-table [config]="config"
...
[columns]="columns"
[totals]="totals"
[pageTotals]="pageTotals">
</ng-table>
</div>
<div *ngIf="columns.length != 9">
<ng-table [config]="config"
...
[columns]="columns"
[totals]="totals"
[pageTotals]="pageTotals">
</ng-table>
</div>
Or you can use whatever boolean you need