akveo / ng2-smart-table

Angular Smart Data Table component
https://akveo.github.io/ng2-smart-table/
MIT License
1.63k stars 878 forks source link

Is it possible to delete all records by clicking a button? #100

Open radha89 opened 7 years ago

radha89 commented 7 years ago

I'm trying to implement a 'Delete all' button in my component so I can empty the table and print 'no data found' message. I tried to call this.source.empty() which works when I log source.data to the console and it appears empty but my table still has data in it. Is there a fix for this?

gorkemgunal commented 6 years ago

Try this var data = []; this.source.load(data);

RodibelMorales commented 4 years ago

I do this this: <ng2-smart-table [settings]="settings_requisition" (deleteConfirm)="deleteRecord($event)" (createConfirm)="addRecord($event)" (editConfirm)="updateRecord($event)" class="responsive-table" [source]="data_requisition">

data_requisition=[]; //On the compenent.ts

and then just call the variable like this: this.data_requisition=[]; when close a modal.