mariuszfoltak / angular2-datatable

DataTable - Simple table component with sorting and pagination for Angular2
202 stars 182 forks source link

Table not updating when objects are added #65

Open ian1908 opened 7 years ago

ian1908 commented 7 years ago

First; love the table!

Second; I am an angular2 beginner and i seem to have run into an issue that i can not get fixed.

I have table containing the object array hours, when i add an hour through a form the hours array gets updated instantly although the table does not refresh. When for example i click on sorting or on number of rows per page the new objects appear.

Is there a way to update / refresh the table? Below my html.

<table *ngIf="customersAvailable" class="table table-striped table-hover" [mfData]="hours" #mf="mfDataTable" [mfRowsOnPage]="100">

Regards

petronetto commented 7 years ago

@ian1908 I faced the same problem... The way that I found to solve it was put an *ngIf="someBollean" in table element and when I update the table, someBollean is setted to false, after to true again. I believe that isn't the "right way", but was only solution that I can found.