From 2f7c6041957b110f9faa01702253bd81166909eb Mon Sep 17 00:00:00 2001 From: alaskowski <alaskowski@ethz.ch> Date: Wed, 20 Sep 2023 16:51:26 +0200 Subject: [PATCH] SSDM-55: Fixed how sample property links are rendered in datagrids --- .../js/views/DataGrid/DataGridController.js | 34 ++++--------------- .../js/views/DataGrid/SampleDataGridUtil.js | 13 ++++++- 2 files changed, 19 insertions(+), 28 deletions(-) diff --git a/ui-eln-lims/src/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/DataGrid/DataGridController.js b/ui-eln-lims/src/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/DataGrid/DataGridController.js index 1f18e84a0b7..1c55b8ea995 100644 --- a/ui-eln-lims/src/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/DataGrid/DataGridController.js +++ b/ui-eln-lims/src/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/DataGrid/DataGridController.js @@ -149,34 +149,14 @@ function DataGridController( var value = null if (column.render) { -// if(Array.isArray(params.value)) { -// var values = params.value.sort(); -// value = []; -// for (var x of values) { -// if(value.length > 0) { -// value.push(', '); -// } -// value.push(column.render(params.row, { -// lastReceivedData: _this.lastReceivedData, -// lastUsedOptions: _this.lastUsedOptions, -// container: params.container, -// value: x -// })); -// } -// } else { - value = column.render(params.row, { - lastReceivedData: _this.lastReceivedData, - lastUsedOptions: _this.lastUsedOptions, - container: params.container, - value: params.value - }); -// } + value = column.render(params.row, { + lastReceivedData: _this.lastReceivedData, + lastUsedOptions: _this.lastUsedOptions, + container: params.container, + value: params.value + }); } else { -// if(Array.isArray(params.value)) { -// value = params.value.sort().join(', '); -// } else { - value = params.value; -// } + value = params.value; } if (value === null || value === undefined || value === "") { diff --git a/ui-eln-lims/src/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/DataGrid/SampleDataGridUtil.js b/ui-eln-lims/src/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/DataGrid/SampleDataGridUtil.js index 5d0b89e4be4..b25f551b62a 100644 --- a/ui-eln-lims/src/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/DataGrid/SampleDataGridUtil.js +++ b/ui-eln-lims/src/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/DataGrid/SampleDataGridUtil.js @@ -963,7 +963,18 @@ var SampleDataGridUtil = new function() { } else if(propertyType.dataType === "SAMPLE") { renderValue = (function(propertyType){ return function(row, params){ - return FormUtil.getFormLink(params.value, "Sample", params.value) + if(Array.isArray(params.value)) { + var result = []; + for (var singleValue of params.value) { + if(result.length > 0) { + result.push(', ') + } + result.push(FormUtil.getFormLink(singleValue, "Sample", singleValue)); + } + return result; + } else { + return FormUtil.getFormLink(params.value, "Sample", params.value); +} } })(propertyType) } -- GitLab