Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

322
Views
In Tabulator 5.0, how do you pass query parameters to ajaxResponse when calling setData?

I'm trying to make use of both the ajaxResponse and setData for a Tabulator 5.0 table. Somewhere my URL parameters are getting lost. In the following code the value for params is and empty object when logged to the console.

I'm using ajaxResponse because the portion of the response I need is in the "results". And I'm using setData because my intention is to repeatedly call it dynamically as my parameters change.

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);
});

So how can I pass "params" so that they are combined with the url to make the proper ajax query call?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

If you are looking to make this request to load the initial data in the table then there is no need to call these functions at all, you can use the ajaxURL and ajaxParams options in the table constructor to automatically trigger the initial ajax request when the table loads

var table = new Tabulator("#example-table", {
    ajaxURL:"/api/v1/myendpoint, //ajax URL
    ajaxParams: {"param_name": "abc"},
});

You can also pass in your columns in a similar way using the columns option:

var table = new Tabulator("#example-table", {
    columns:[
        {title:"Name", field:"name", sorter:"string", width:200, editor:true},
        {title:"Age", field:"age", sorter:"number", hozAlign:"right", formatter:"progress"},
    ],
});

If you are looking to call the setData function at a later point, then you are calling it correctly in your example. There was a bug in the initial 5.0 release that prevented parameters being correctly set through the setData function, but that has been resolved in a sebsequent patch release.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!