Changing cell type back to text

Tags: #<Tag:0x00007efc7097f720> #<Tag:0x00007efc7097f5e0>

I have a function that sets the cell type to an autocomplete:

const createFactCells = function(coordinates) {
var i = coordinates['row']
var addCoordsList = []
while (i <= coordinates['row2']) {
    hot.setCellMetaObject(i, coordinates['column'], 
    {
        type: 'autocomplete',
        source:  Object.keys(localFacts['facts']), 
        strict: true,
        allowInvalid: false, 
        labelType: 'fact'
      });
    i = i + 1
};
hot.render();
hot.selectCell(coordinates.row, coordinates.column);

}

When I want to revert this back to a text cell, I run the following function. The cell becomes’s cell type. but I am not able to edit the contents (keeps defaulting back to the old value). How do I fix this?

hot.setCellMetaObject(i, j, {type: 'text');

Hi @mariothomas

Can you tell me which version of Handsontable do you use? We’ve had some issues regarding this hook in previous versions, but it was fixed recently and it seems to be working correctly in my test here with version 12.3.2: https://jsfiddle.net/aszymanski/kho8Lzfx/

Thanks. I was able to solve the issue by changing to the following (factRenderer is a custom renderer I have defined elsewhere):

    hot.setCellMetaObject(coordinates.row, coordinates.column, {type: 'text', allowInvalid: true, renderer: factRenderer, validator: null});

I’m glad you found the solution. I will close this topic then.