the data is stored in the data flow and displayed in a tabulator

Tabulators Ajax documentation specifies the format that the data needs to be returned in, in order for Tabulator to process it. Checkout the Documentation for full details.

Essentially your ajax response must return a JSON encoded array of row objects, with each object in the array representing a row of data. Eg:

[
    {"id":1, "name":"bob", "age":"23"},
    {"id":2, "name":"jim", "age":"45"},
    {"id":3, "name":"steve", "age":"32"}
]

If you cant return the data in that format, then you can use the ajaxResponse callback to process the response and convert it into that format before it is passed into the table.

Full details of all of this can be found in the Ajax Documentation

Update – passing data into the table

The issue with loading in data is because you are calling the setData function before event creating the table:

$("#example-table").tabulator("setData", "http://127.0.0.1:5000/test");

This function does not return data, it tells tabulator to go and retrieve it, so your above option does nothing.

If you only need to load the data when the table is first loaded then the best approach is to not use setData or the data property at all. Instead use the ajaxURL property in the table constructor object and pass the url to it

var table = new Tabulator("#example-table", {
    ajaxURL:"http://www.getmydata.com/now",
    ....//other table setup options
});

Full details of all of this can be found in the first paragraph of the documentation of loading data in using ajax, see the Ajax Documentation

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top