Assign column meta data to colsettings

Tags: #<Tag:0x00007efc654dd7b8> #<Tag:0x00007efc654dd678>

Hi,
Is there a way I can store some meta data in the column settings?

I have a renderer function as a named alias that I use across multiple handsontable instances. At the moment my workaround is to store content in the header css class name upon initilization.

A use case for example would be I wish to store the decimal precision (substitute anything here - but this is a simple example) in the class header name.
My renderer function currently then gets the colSetting and then parses the value stored in the css class name and then uses that value to render the content.

Is there a more elegant way of achieving something similar? I am using v14.5.0.
Thanks

Hi @russell.thomson

Thank you for contacting. Can you please share your current implementation in a code demo? That way it will be easier to understand the requirements and propose alternative solution.

Hi Adrian,

Thanks for responding here is a simple renderer:

export function myRendererNumeric(hot: Handsontable
, td: any
, row: number
, column: number
, prop: any
, value: any
, cellProperties: any) {

let colItem: ColumnSettings = hot.getColumnMeta(column);
// let noOfDecimals = colItem.noOfDecimals;
let noOfDecimals = colItem.headerClassName;

if (value != null && !isNaN(value)) {

td.innerHTML = value.toFixed(noOfDecimals);

}

}

As you see I am using the header class name for not really its intended purpose only for the reason that I am looking to be able to store my own meta data and thats the only place I have found …

Hi @russell.thomson

Sorry for the late response, but we had some issues with the notifications.

Unfortunately, this code won’t be enough to determine the issue. Can you please use a sandbox like StackBlitz to present the whole logic?

Hi @russell.thomson

I need to close this ticket, as it has been two weeks without any response.

If the issue is still replicable, please create a new thread or contact us at support@handsontable.com.