I'm currently facing an issue with utilizing both ajaxResponse and setData for a Tabulator 5.0 table. It seems that my URL parameters are disappearing somewhere in the process. When I log the value of params to the console in the code below, it appears as an empty object.
The reason I am using ajaxResponse is because the specific portion of the response I need is nested under "results". Additionally, I am leveraging setData as I intend to dynamically call it multiple times while changing the parameters.
var table = new Tabulator("#my-tabulator-table", {
ajaxResponse: function(url, params, response){
console.log(url);
console.log(params);
return response.results;
},
});
var columns = [
{title: "id", field: "id", headerFilter: false, visible: true, download: true},
{title: "field1", field: "field1", headerFilter: true, visible: true, download: true},
{title: "field2", field: "field2", headerFilter: true, visible: true, download: true},
{title: "field3", field: "field3", headerFilter: true, visible: true, download: true},
];
var url = "/api/v1/myendpoint";
var params = {"param_name": "abc"};
table.on("tableBuilt", function(){
table.setColumns(columns);
table.setData(url, params);
});
My main challenge lies in figuring out how to correctly pass the "params" so that they are included in the URL for the ajax query call. Any suggestions on solving this?