Ajax DataSource refresh incorrect URL
Ajax DataSource refresh incorrect URL
I am attempting to upgrade to Datatables 1.10 and I would like to use the new server side processing hooks. I have the following initialization configuration:
var dTable = $('#statusTable').dataTable({
"processing": true,
"serverSide": true,
"ajax": { "url": "ajax/status/foooo", "type": "GET" }
});
The URL portion of the "ajax" key is only used on initial page load. Any other actions (sort, filter,etc...) are all directed at the current page URL (for example if the current page is http://url/status
then the refresh URL will be http://url/status?draw=...
instead of http://url/ajax/status/foooo?draw=...
).
I am expecting that the "ajax" URL should be used to fetch all data for this datatable as in [Datatables Server Side Example] (http://datatables.net/examples/server_side/object_data.html). Anyone know what I am doing wrong?
This question has an accepted answers - jump to answer
Answers
Can you link to the page please.
Allan
Unfortunately the page is not publicly accessible. I can remove functionality until I get to the issue, but I was more wondering if there was a common configuration error which may result in this behavior.
I have added a dataSrc (with console.log) to test if the "ajax" value on the datatable was being used, and as expected it is not being used (the console.log is only displayed on initial page load):
I guess the question is how is it possible to have datatables use the value of "ajax" on page load, but then not use it on subsequent data table updates?
I think I may have discovered the cause... I was using the [jquery.dataTables.columnFilter.js plugin version 1.5.6] (http://code.google.com/p/jquery-datatables-column-filter/source/browse/trunk/media/js/jquery.dataTables.columnFilter.js) and initializing as follows:
I removed the column filter functionality and the ajax functionality behaves as expected. Solution would have to be update plugin or use new [1.10 column filter functionality] (http://datatables.net/examples/api/multi_filter.html).