From 5aea7ccbc9d8fa3b909c2a4e18093944dbce150d Mon Sep 17 00:00:00 2001 From: Molkobain Date: Wed, 26 Apr 2023 10:33:18 +0200 Subject: [PATCH 1/2] =?UTF-8?q?N=C2=B06124=20-=20Performance:=20Draw=20dat?= =?UTF-8?q?atable=20only=20once=20when=20elements=20remove=20in=20linksets?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- js/linkswidget.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/js/linkswidget.js b/js/linkswidget.js index d7a51736c..30b6fb792 100644 --- a/js/linkswidget.js +++ b/js/linkswidget.js @@ -61,7 +61,7 @@ function LinksWidget(id, sClass, sAttCode, iInputId, sSuffix, bDuplicates, oWizH this.RemoveSelected = function () { let my_id = '#'+me.id; $('#linkedset_'+me.id+' .selection:checked').closest('tr').each(function () { - $('#datatable_'+me.id).DataTable().row($(this)).remove().draw(); + $('#datatable_'+me.id).DataTable().row($(this)).remove(); var oCheckbox = $(this).find('.selection'); let iLink = $(oCheckbox).attr('data-link-id'); if (iLink > 0) { @@ -80,6 +80,9 @@ function LinksWidget(id, sClass, sAttCode, iInputId, sSuffix, bDuplicates, oWizH me.aAdded[iUniqueId] = null; } }); + // N°6124 Only draw table once for performance reasons + $('#datatable_'+me.id).DataTable().draw(); + // Disable the button since all the selected items have been removed $(my_id+'_btnRemove').prop('disabled', true); From c6edbf982d7e8de5f6041b38a319b4d124189df0 Mon Sep 17 00:00:00 2001 From: Molkobain Date: Wed, 26 Apr 2023 11:24:34 +0200 Subject: [PATCH 2/2] =?UTF-8?q?N=C2=B06124=20-=20Performance:=20Draw=20dat?= =?UTF-8?q?atable=20only=20once=20when=20elements=20added=20in=20linksets?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- js/linkswidget.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/js/linkswidget.js b/js/linkswidget.js index 30b6fb792..61c0ccd9e 100644 --- a/js/linkswidget.js +++ b/js/linkswidget.js @@ -254,9 +254,10 @@ function LinksWidget(id, sClass, sAttCode, iInputId, sSuffix, bDuplicates, oWizH function (data) { if (data != '') { $.each(data.data, function (idx, row) { - $('#datatable_'+me.id).DataTable().row.add(row).draw(); + $('#datatable_'+me.id).DataTable().row.add(row); }); - + // N°6124 Only draw table once for performance reasons + $('#datatable_'+me.id).DataTable().draw(); $.each(data.scripts, function (idx, script) { $.globalEval(script); @@ -266,7 +267,6 @@ function LinksWidget(id, sClass, sAttCode, iInputId, sSuffix, bDuplicates, oWizH $(this).trigger('validate', ''); }); // Validate newly added form fields... $('#datatable_'+me.id).DataTable().columns.adjust().draw(); - //$('#datatable_team_list').DataTable().columns.adjust().draw(); $('#busy_'+me.iInputId).html(''); } },