Three side ajax still happening
Three side ajax still happening
According to this thread - https://datatables.net/forums/discussion/71239, this should have been resolved.
I am using the latest version:
I am still seeing three identical calls AJAX when a search is performed. Here is my definition:
var datatable = $('#dataTable')
.DataTable({
responsive: false,
autoWidth: true,
lengthChange: false,
serverSide: true,
scrollX : true,
deferLoading: 0,
dom: 'pQlrtip',
language: {
searchBuilder: {
title: 'Report Builder',
data: 'Column',
add: 'Add Criteria',
condition: 'Criteria'
}
},
searchBuilder: {
liveSearch: false,
preDefined: definition
},
ajax: {
url: '?handler=ListItems',
type: 'POST',
data: function (d) {
d.refreshResults = refreshResults
},
headers: {
RequestVerificationToken:
$('input:hidden[name="__RequestVerificationToken"]').val()
},
beforeSend: function () {
if (!$(".dtsb-search").is(":visible")) return false;
if (!isCriteriaValid()){
return false;
}
showLoader();
},
complete: function (x) {
hideLoader();
refreshResults = false;
},
},
"columns": tableColumns,
pageLength: 25
})
.on('search.dt', function () {
searchPerformed();
});
Replies
I have determined that the problem occurs only with predefined criteria. I am saving the criteria that was used on the page and when the page loads, I have the criteria preloaded. If you look above, I have preDefined set to a variable. I have the variable defined as:
var definition = {"logic":"AND","value":[],"criteria":[{"condition":"contains","data":"Name","origData":"name","type":"string","value":["j"]}]};
I did try and load the definition post creation of the table with
datatable.searchBuilder.rebuild(definition);
This has the same problem with the multiple ajax calls.
Hi,
Thanks for flagging this up. I've logged this on my bug tracker to take a look at it when the dust from the DT2 release has settled
Allan
I just updated to 1.7 and the multiple ajax seems to be gone.