From d5f444e98c3e0b62054e272d9742cc4af149b058 Mon Sep 17 00:00:00 2001 From: alex Date: Thu, 6 Jun 2019 10:12:33 +0200 Subject: [PATCH] public/tablesort.js: tablesorter is destroyed before new initialization if already applied to a table --- public/js/tablesort/tablesort.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/public/js/tablesort/tablesort.js b/public/js/tablesort/tablesort.js index 1876ad8a5..345a21bad 100644 --- a/public/js/tablesort/tablesort.js +++ b/public/js/tablesort/tablesort.js @@ -5,9 +5,18 @@ var Tablesort = { * @param sortList columns to sort by, as array of arrays (each array contains column number and 1/0 for asc/desc order) * @param widgets optional widgets like zebra or filter * @param minrows optional minimal amount of rows for filter row to be shown (only relevant for filter widget) + * @param additionalParams any additional parameters as JS object */ addTablesorter: function (tableid, sortList, widgets, minrows, additionalParams) { + if (typeof $("#" + tableid)[0] === "undefined") + return; + + if ($("#" + tableid)[0].hasInitialized) + { + $("#" + tableid).trigger("destroy"); + } + var tablesorterobj = { theme: "default",