Fix chiamate ajax infinite con l'impostazione di calcolo totali ristretti a selezione

This commit is contained in:
loviuz 2022-10-27 19:23:16 +02:00
parent 512e04ef45
commit 03394391bc
1 changed files with 17 additions and 11 deletions

View File

@ -16,6 +16,8 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
var first_load_complete = false;
function start_local_datatables() { function start_local_datatables() {
$('.datatables').each(function () { $('.datatables').each(function () {
if (!$.fn.DataTable.isDataTable($(this))) { if (!$.fn.DataTable.isDataTable($(this))) {
@ -348,19 +350,21 @@ function initComplete(settings) {
setTimeout(function () { setTimeout(function () {
$('.select-checkbox').each(function(){ $('.select-checkbox').each(function(){
var row = $(this).parent(); if (first_load_complete) {
var row_id = row.attr("id"); var row = $(this).parent();
var row_id = row.attr("id");
var table_selector = $(this).closest(".dataTable"); var table_selector = $(this).closest(".dataTable");
var wrapper = getTable(table_selector); var wrapper = getTable(table_selector);
if(typeof row_id !== "undefined"){ if(typeof row_id !== "undefined"){
if (row.hasClass("selected")) { if (row.hasClass("selected")) {
//table.datatable.rows("#" + row_id).select(); //table.datatable.rows("#" + row_id).select();
wrapper.addSelectedRows(row_id); wrapper.addSelectedRows(row_id);
} else { } else {
//table.datatable.rows("#" + row_id).deselect(); //table.datatable.rows("#" + row_id).deselect();
wrapper.removeSelectedRows(row_id); wrapper.removeSelectedRows(row_id);
}
} }
} }
}); });
@ -402,6 +406,8 @@ function drawCallback(settings) {
}).select(); }).select();
} }
}); });
first_load = true;
} }
function footerCallback(row, data, start, end, display) { function footerCallback(row, data, start, end, display) {