From ba92f57d52b78c248ce85d70aad6e937ef4dc269 Mon Sep 17 00:00:00 2001 From: Nick Mastoris Date: Tue, 23 Jul 2024 18:04:15 +0300 Subject: [PATCH] try to fix links at datatable --- javascript/src/components/Common/utils.js | 18 ++++-------------- javascript/src/components/datatable.js | 5 +++++ 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/javascript/src/components/Common/utils.js b/javascript/src/components/Common/utils.js index a0cc8a5..bf903f2 100644 --- a/javascript/src/components/Common/utils.js +++ b/javascript/src/components/Common/utils.js @@ -141,20 +141,10 @@ export function calculateMinMax(dataArray) { return [min, max] } -export const createAnchorElement = (title, link) => { - const anchor = document.createElement('a'); - const linkText = document.createTextNode(title); - anchor.appendChild(linkText); - anchor.title = title; - anchor.href = link; - - // FIXME: - // Trying to pass an object directly to the datatable will fail. We need to - // get the HTML string from the element. This causes inconsistent behavior - // which we need to solve. For now we leave it as is. - return anchor.outerHTML; - // return anchor; -} +export const createAnchorElement = (title, link) => ({ + title, + link, +}); export const axisChartOptions = (title, hAxisFormat, hAxisTicks) => { return ( diff --git a/javascript/src/components/datatable.js b/javascript/src/components/datatable.js index c32cbb4..2440272 100644 --- a/javascript/src/components/datatable.js +++ b/javascript/src/components/datatable.js @@ -150,6 +150,7 @@ class Datatable extends Component { } listNames = (names, key) => { + //console.log("listNames called with:", names.title); if (this.props.columnSep && key == this.props.columnSep && typeof names === 'string') { return renderToString( ) + } else if (names && typeof names === 'object' && names.title && names.link) { + return renderToString( + {names.title} + ); } else return ( names )