From 58a360bd33cc8d2cfdcb3b5d09f6a2f9f17b254a Mon Sep 17 00:00:00 2001 From: Piotr Gawron <piotr.gawron@uni.lu> Date: Mon, 17 Sep 2018 15:48:35 +0200 Subject: [PATCH] order column contains only number --- .../src/main/js/gui/leftPanel/OverlayPanel.js | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/frontend-js/src/main/js/gui/leftPanel/OverlayPanel.js b/frontend-js/src/main/js/gui/leftPanel/OverlayPanel.js index 224549a89a..d711dda067 100644 --- a/frontend-js/src/main/js/gui/leftPanel/OverlayPanel.js +++ b/frontend-js/src/main/js/gui/leftPanel/OverlayPanel.js @@ -329,7 +329,7 @@ OverlayPanel.prototype.overlayToDataRow = function (overlay, checked, disabled) result[4] = ""; } if (overlay.getDescription() !== "") { - for (var i = 0; i < result.length; i++) { + for (var i = 1; i < result.length; i++) { result[i] = "<div class=\"minerva-tooltip\">" + result[i] + "<span class=\"minerva-tooltip-text\">" + overlay.getDescription() + "</span>" + @@ -579,6 +579,7 @@ OverlayPanel.prototype.init = function () { var table = $(this.getControlElement(PanelControlElementType.OVERLAY_CUSTOM_OVERLAY_TABLE)).DataTable({ columns: [{ title: 'No', + type: 'num', className: "no_padding" }, { title: 'Name' @@ -605,8 +606,18 @@ OverlayPanel.prototype.init = function () { for (var i = 0, ien = diff.length; i < ien; i++) { var rowData = table.row(diff[i].node).data(); - var overlayId = $(rowData[2]).attr("data"); - promises.push(self.updateOverlayOrder(overlayId, diff[i].newData)); + var checkbox = $("[type='checkbox']", rowData[2])[0]; + if (checkbox === undefined) { + checkbox = rowData[2]; + } + var overlayId = parseInt($(checkbox).attr("data")); + var order; + if (Functions.isInt(diff[i].newData)) { + order = diff[i].newData; + } else { + order = parseInt($.parseHTML(diff[i].newData)[0].innerHTML); + } + promises.push(self.updateOverlayOrder(overlayId, order)); } promises.push(self.getMap().redrawSelectedDataOverlays()); return Promise.all(promises); @@ -619,7 +630,7 @@ OverlayPanel.prototype.init = function () { * * @param {number} overlayId * @param {number} order - * @returns {PromiseLike} + * @returns {Promise} */ OverlayPanel.prototype.updateOverlayOrder = function (overlayId, order) { var self = this; -- GitLab