diff --git a/assets/src/js/functions/datatables.js b/assets/src/js/functions/datatables.js index b2be072f5..b6088d437 100755 --- a/assets/src/js/functions/datatables.js +++ b/assets/src/js/functions/datatables.js @@ -16,6 +16,8 @@ * along with this program. If not, see . */ +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) {