Removing data from data source does not remove rows in Datatable

Hi, I have a DataCollection loading JSON data from PHP. That part works 100%.

The DataCollection instance variable is set as the value for my Datatable’s data property. When I add data (save new data via Ajax to database) and reload the DataCollection a new row gets added to my DataTable. But when I delete a row from my DataTable (again via Ajax to delete from database) the row is not removed from my DataTable after I reload the DataCollection (I see the deleted data is missing in the new JSON reponse).

I tried to use the remove(id) method to remove the row from the DataTable but it clears the contents of the row without removing the row from the DataTable. I also tried to call refresh() on the DataTable after reloading the data but still get no success.

I’ve looked through the guides and looked for a method to call to force the DataTable to reload its data, but no success. It is as if the data in the DataTable is cached although the JSON response shows different data.

What am I missing? (Btw I’m using Webix Jet if that helps)

after I reload the DataCollection

Which code are you using for DataCollection reloading ? It must be something like

data.clearAll();
data.load();

without the first line, the old data will not be removed from the DataColleciton.

Also, instead of full reload, you can delete row from data collection ( not from datatable ) - collection.remove(id)

Awesome, thank you!

I did not realize I had to call clearAll() on the DataCollection before reloading.

I incorrectly assumed by loading the data again it would remove the old data.

i’m using grid.data.sync(dataCollecttion); with this old data is removed, right?