Search code examples
tabulator

Tabulator - How to refresh table from json file


I am trying to update my Tabulator table from a JSON file. When an item is submitted or deleted, it triggers a PHP file that updates the file fine. However, the table does not update. If I hard reload the page (CTRL+F5), the table updates correctly. Otherwise, it will not update with a regular reload. I have a location.refresh(); in my code for deleting with a successful ajax request to my PHP file. My PHP files have a "Refresh:0; url = tabulator.html". I have tried adding to the top of my html page:

<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Expires" content="0" />

and to the top of my PHP file:

header('Cache-Control: no-cache, no-store, must-revalidate'); // HTTP 1.1.
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache'); // HTTP 1.0.
header('Expires: 0');

At the end of my table creation i have table.setData(); since I use an ajaxURL to load the data in the table. Anyone have any idea how I can refresh the table with the data from the JSON file when an item is submitted or deleted? Thanks in advance.


Solution

  • use reactiveData:true, //enable reactive data checkc documentation