Are there future plans for "ajax.data" functionality?

Are there future plans for "ajax.data" functionality?

RuddockTRuddockT Posts: 2Questions: 2Answers: 0
edited June 2014 in Free community support

We are currently using DataTables 1.10.0 and I noticed the table was being rebuilt for every refresh (using destroy set to true) - obvioulsy this is pretty inefficient.

I wanted to change this so that purely the data part fo the table was refreshed as part of the ajax call. It appeared the data.reload() is what I ought to use to achieve this.

The table that's being rendered has two filter fields, the user enters a value and/or selects a date. They then press a 'filter' button to perfom the filtering (which is done server-side and not within the datatable itself).

The code in my dataTable object contains the lines:

ajax: {     
    url: "fetchData.html",
    data: {filter1: $('#filter1').val(),
              filter2: $('#filter2').val()}
}

This works fine with the destroy method, however when I change the code to use data.reload() instead of reinitialisng the table each time the filters stop working.

After some investigation a colleague and I discovered that the 'dt-api data.reload()' doesn't take account of the data keyword in the ajax section.

Instead we ended up removing the data from the ajax section and using data.url().load() - feeding the data as parameters on the url:

var url = 'fetchData.html?filter1=' + $('#filter').val() + '&filter2=' + $('#filter2').val();
        dataTable.ajax.url(url).load();

Whilst this works, it doesn't feel quite right.

Both my colleague and I are of the opinion it would be good to have a ajax.data option that fed into the ajax.reload() function - are there any plans to introduce this at all?

This discussion has been closed.