I want to add a custom cell type to simply be a button, so I registered a custom cell type as follows:
Handsontable.cellTypes.registerCellType('UI.button', { editor: undefined, validator: undefined, renderer: function(instance, td, row, col, prop, value, cellProperties) { td.style.verticalAlign = "middle"; td.style.textAlign = "center"; td.innerHTML = '<button style="width:100%; height:90%;">' + value + '</button>'; }, });
however, I was only able to use this cell type through the cells
property in the option. I want to be able to set it dynamically after a certain user interaction. For example, if a user selects a cell and chooses to make it a button, I want to set cellProperties.type = "UI.button"
, or at least set the renderer only. However, I couldn’t find a way to do that except in the cells
option, but I can’t check for the cell meta inside of it as it causes an error (unlike reading the data).
How can I achieve this?