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