I am working on an angular project that displays a set of data. For that I am using primeNG data table. Everything works fine but when I delete an entry from the data source the data table is not refreshing I can still see the deleted entry in the table. Any help will be appreciated.
mycomponent.html
<p-dataTable [value]="tabledata">
<p-column field="vin" header="Vin"></p-column>
<p-column field="year" header="Year"></p-column>
<p-column field="brand" header="Brand"></p-column>
<p-column field="color" header="Color"></p-column>
</p-dataTable>
iam slicing the datasource on deletion
mycomponent.ts
this.tabledata.slice(this.tabledata.indexOf(datatodelete), 1);
Finally i end up with solution. I just created a copy of my data source. And delete the entry from this copy, then reassign this copy to my original data source.
this.datatablecopy = Object.assign([], this.datatable);
this.datatablecopy.slice(this.datatablecopy.indexOf(datatodelete), 1);
this.datatable = this.datatablecopy;