toHTML() does not regard columnrenderer

Tags: #<Tag:0x00007f8b1d2833b8>

Hi there,

i have a VUE app where a hot with a custom columnrenderer is used.

settings: {
columns: [
{ type: ‘text’, title: ‘VALUE_ACT’, data: ‘valueAct’, renderer: this.VALUE_ACTRenderer },
]
}

The render function:
VALUE_ACTRenderer (instance, td, row, col, prop, value, cellProperties) {
if (value === 123) {
arguments[5] = ‘Fail’
Handsontable.renderers.TextRenderer.apply(this, arguments)
} else {
Handsontable.renderers.TextRenderer.apply(this, arguments)
}
}

When the page + table are completely loaded, there is a print function availaible which uses the
this.$refs.hotTable.hotInstance.toHTML() function. Sadly the “updated” rendered cells getting there initial values (i.e. 123 instead of Fail)

PS: if there are filters / sorting used in the table before, these changes are also visible in the HTML !

Any ideas how to send the actual content to the HTML() function?

Thanks in advance!

Hi @marc.proske

to confirm - your code looks similar to this https://jsfiddle.net/handsoncode/gtjdzwfa/ and you want

  • fail to show in the filters
  • fail printed within the toHTML() result

Hi,

yes this is the the use-case. Printing as HTML is the only way to get the whole report (i.e. a few thousand rows with up to 10 columns., see my other post).

If there are specific values - i.e. the “123” they have to be replaced by some more human readable content.

Thanks!

Thank you for the confirmation.

The only way to get fail in the toHTML() and filters is to set it as data (renderer only changes the visualization of the data for the user).

But as I’m sure that 123 is there for a reason and you need it I recommend keeping that value under a key that you’d follow in the cell meta. Here https://jsfiddle.net/handsoncode/tb7rw0xk/ is an example of cell meta that keeps details about cells.When you double click the Ellie’s family cell you’ll get a notification in the console that comes from cell meta that shares the details about family members. As we can see here https://jsfiddle.net/handsoncode/24u6qgz9/ the ‘human-like’ Ellie’s family is in the cell, in the filters and the toHTML() call.

Hi Aleksandra,

the values are only for printing, editing / further working with these values is not permitted. So it would not be a problem if these are replaced in the data part. Using all kind of workarounds are decreasing the performance in this case where very “big” data is used. I am already using the validateCells() method to show dates in another format, the render() method had no effect there.

Is there another way to get the desired result?

Thank you

I think that the best way to share the most valuable tips would be to work on the example. You may have some settings that are crucial to include in an example to share an efficient way to solve the case.
Could you send me your license ID and an example code at support@handsontable.com ?

I mailed the support the needed information.
Thanks!