From 9c05326573b35b0bf24a266eec0594db1f94c13d Mon Sep 17 00:00:00 2001 From: Owen Stephens Date: Thu, 19 Apr 2018 12:00:38 +0100 Subject: [PATCH 1/2] Added option to toggle show/hide null values in cells in data-table --- main/webapp/modules/core/langs/translation-en.json | 1 + .../scripts/views/data-table/data-table-view.js | 13 ++++++++++++- .../modules/core/styles/views/data-table-view.less | 1 + 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/main/webapp/modules/core/langs/translation-en.json b/main/webapp/modules/core/langs/translation-en.json index 5fe0605a6..55099f9cb 100644 --- a/main/webapp/modules/core/langs/translation-en.json +++ b/main/webapp/modules/core/langs/translation-en.json @@ -600,6 +600,7 @@ "view": "View", "collapse-all": "Collapse all columns", "expand-all": "Expand all columns", + "display-null": "Show/Hide 'null' values in cells", "reorder-perma": "Reorder rows permanently", "by": "By", "custom-text-trans": "Custom text transform on column", diff --git a/main/webapp/modules/core/scripts/views/data-table/data-table-view.js b/main/webapp/modules/core/scripts/views/data-table/data-table-view.js index 333940621..20fd9bbce 100644 --- a/main/webapp/modules/core/scripts/views/data-table/data-table-view.js +++ b/main/webapp/modules/core/scripts/views/data-table/data-table-view.js @@ -39,6 +39,7 @@ function DataTableView(div) { this._collapsedColumnNames = {}; this._sorting = { criteria: [] }; this._columnHeaderUIs = []; + this._shownulls = false; this._showRows(0); } @@ -134,7 +135,10 @@ DataTableView.prototype.render = function() { this._renderDataTables(elmts.table[0], elmts.headerTable[0]); this._div.empty().append(html); - + + // show/hide null values in cells + $(".data-table-null").toggle(self._shownulls); + this.resize(); elmts.dataTableContainer[0].scrollLeft = scrollLeft; @@ -741,6 +745,13 @@ DataTableView.prototype._createMenuForAllColumns = function(elmt) { self._collapsedColumnNames = []; self.render(); } + }, + { + label: $.i18n._('core-views')["display-null"], + id: "core/display-null", + click: function() { + $(".data-table-null").toggle(); + self._shownulls = !(self._shownulls); } ] } diff --git a/main/webapp/modules/core/styles/views/data-table-view.less b/main/webapp/modules/core/styles/views/data-table-view.less index 327e9dacd..da127748b 100644 --- a/main/webapp/modules/core/styles/views/data-table-view.less +++ b/main/webapp/modules/core/styles/views/data-table-view.less @@ -203,6 +203,7 @@ div.data-table-cell-content-numeric > a.data-table-cell-edit { .data-table-null { color: #aaa; + display: none; } .data-table-error { From 4c19a3170e43778d9d6ad19c7a0c4fd8c42ab127 Mon Sep 17 00:00:00 2001 From: Owen Stephens Date: Thu, 19 Apr 2018 14:45:14 +0100 Subject: [PATCH 2/2] Fixed syntax error --- .../modules/core/scripts/views/data-table/data-table-view.js | 1 + 1 file changed, 1 insertion(+) diff --git a/main/webapp/modules/core/scripts/views/data-table/data-table-view.js b/main/webapp/modules/core/scripts/views/data-table/data-table-view.js index 20fd9bbce..25401764d 100644 --- a/main/webapp/modules/core/scripts/views/data-table/data-table-view.js +++ b/main/webapp/modules/core/scripts/views/data-table/data-table-view.js @@ -752,6 +752,7 @@ DataTableView.prototype._createMenuForAllColumns = function(elmt) { click: function() { $(".data-table-null").toggle(); self._shownulls = !(self._shownulls); + } } ] }