Is there a way to attach a Hash or unique identifier with a header? I need to track changes to the spreadsheet (remove/insert col/etc…) and associate that with some metadata. This is independent of header name (as it could change).
Thanks
Is there a way to attach a Hash or unique identifier with a header? I need to track changes to the spreadsheet (remove/insert col/etc…) and associate that with some metadata. This is independent of header name (as it could change).
Thanks
Hi @gofactr
Should it be attached to a header, header and cells underneath? Should it be attached to a column with the given index or move with columns (applied for manualColumnMove feature).
It would be attached with the column and move with the column. Essentially I want to “Tag” a column so I can look-up metadata associated with that column, whatever the user does to the table. Does that help?
Here’s an example that we can work with https://jsfiddle.net/ujza01mn/1/
I attached custom meta under myCustomMeta
key and a string value of Column_1
to all the cells in columns index 1.Thanks to the toPhysicalColumn
method, when you move columns, the meta value myCustomMeta
is still attached to the same column.
Does it meet your project requirements?
Thanks for trying, this doesn’t quite fit my needs. I guess I’ll try to mock something up myself. Is there a reason why columns headers don’t have a meta property?
There seems to be no way to maintain a reference to a column short of adding a hidden html reference to the column header, i.e. <span style="display: none;">Unique ID</span>
. However, inserting new columns doesn’t allow for control of header name. Is there anyway you can suggests to get around this?
Hi @gofactr,
In most scenarios putting custom elements into DOM structure is unnecessary. You can track most actions by listening hooks like:
afterCreateCol
,afterCreateRow
,afterRemoveCol
,afterRemoveRow
,afterChange
You can find a complete list of hooks with its description here: https://handsontable.com/docs/8.3.2/Hooks.html.
If you need to identify columns, you probably should use an array of objects
dataset, where each column has to be defined by its key (property). That type of dataset needs your implementation of adding/removing columns.
Additionallym I prepared examples of customizations:
A) columns
array with title
option: https://jsfiddle.net/swistach/xvbg0nco/
B) colHeaders
as a function with a custom store for columns’ metadata: https://jsfiddle.net/swistach/dhjkp83n/