Refresh cell after renderer update?

Tags: #<Tag:0x00007efc6061e460>

Is there a way to refresh a cell after its renderer was updated using setCellMeta?

Currently it looks like the cell does not re-render after this function is called and the user needs to re-insert the value to see any changes.

Yes, the setCellMeta() requires an additional render() call.

Could you just share an explanation of what is after its renderer was updated, you mean that you (at a certain point) want to change a cell renderer via setCellMeta()?

Hi @aleksandra_budnik, thanks for your reply.

What I mean is that I’ve a button in my UI to format a cell as a currency (using a custom renderer):

function handleClick(row, col) {
    this.hot.setCellMeta(row, col, "renderer", "currency");
}

The problem is that if the cell already contains a value, the displayed value is not updated after this call.

For example if the cell already contains a value like 1.00 and the user press the button to format it as a currency, the displayed value will not be updated to £1.00.

Hope this is clear :slight_smile:

Yes, then render() is definitely needed. Here’s a full example https://jsfiddle.net/5682vL19/

Great thanks, I didn’t know about the render() method

You’re more than welcome, @nicola

Please feel free to open a new ticket or contact us at support@handsontable.com with any future questions.