[GHDEV #1813] Export `getRenderedValue` util in Core

Tags: #<Tag:0x00007f136ca14f38> #<Tag:0x00007f136ca14c40>

Hi!
I am working on adding HTML title attribute to a cell element (<td />).
I found a way to do it using renderer as function, doing td.title = value.
The problem is that I am using the numericFormat option in some cells, so for example 23.4 is rendered as $23.40.
I delved into the Handsontable code and found a function called getRenderedValue that formats the value using numbro.js.
Is there any way to use this function other than copying and pasting it into my code?

Hi @alojzy231

Wouldn’t it be better to use numbro’s format()? Here’s an example https://stackblitz.com/edit/vitejs-vite-rnxmcr?file=main.js,style.css&terminal=dev

Outcome

50

Since Handsontable uses numbro to format values when we pass numericFormat property to a column’s config I believe it would be nice if getRenderedValue util had been exposed in Core. That way we wouldn’t need to duplicate/reference numeric format (e.g. $0,0.00) in two places (column’s config and place where we want to have rendered value)

That is true, but getRenderedValue is marked as a helper, and we decided not to export any helpers. We’d rather create an alias. I will report this need internally and update you with any progress in this matter.

1 Like