Can't get cell type

Tags: #<Tag:0x00007efc6465eea8> #<Tag:0x00007efc6465ed68>

Hello.
I use ver 13.0.3 for non-commercial-and-evaluation license.

I’cant’ get any value from getCellMeta(row, col).type property: it returns full property structure not only the ‘type’.

This is my code:

hot.addHook('beforeChange', function (changes, source) {
    if (source === 'loadData' || source === 'internal' || changes.length > 1) {
        return;
    }
     console.log('beforeChange event raised...');
    console.log(hot.getCellMeta(0, 0).editor);
    console.log(hot.getCellMeta(0, 0).myPK);
     console.log(hot.getCellMeta(0, 0).type);
})

When I ask for ‘editor’ and ‘myPK’ property I getcorrect value but for ‘type’ I get full propery definition.
This from the console:

beforeChange event raised…
false
true
{editor: false, copyable: false, myPK: true, type: ‘numeric’}
copyable: false
editor: false
myPK: true
type: “numeric”

To be complete I write also the code I use for fill CellPrp (in C#) :

        // Cycle on Def table in order to build hot cells properties
        String CellPrp = "[";
        foreach (DataRow row in dt_TabDef.Rows)
        {
            CellPrp = CellPrp + "{";
            if (row["Primary Key"].Equals(true))
            {
                CellPrp = CellPrp + " editor: false , copyable: false, myPK: true,";
            }

            switch (row["Data type"])
            {
                case "varchar" or "bit" or "nvarchar" or "char":
                    CellPrp = CellPrp + "type: 'text',";
                    break;

                case "datetime" or "date":
                    CellPrp = CellPrp + "type: 'date',";
                    break;

                case "decimal" or "int"  or "bigint":
                    CellPrp = CellPrp + "type: 'numeric',";
                    break;

                case "time":
                    CellPrp = CellPrp + "type: 'time',";
                    break;
                default:  
                    CellPrp = CellPrp + "type: 'autocomplete',";
                    break;
            }
            CellPrp = CellPrp.Remove(CellPrp.Length - 1);  //remove last comma
            CellPrp = CellPrp + "},";
        }
        CellPrp = CellPrp.Remove(CellPrp.Length - 1);  //remove last comma
        CellPrp = CellPrp +  "]";

As you can see I ask type value for cell located in 0,0, where column 0 is my primary key (note myPk = true).

Coud you help me to recover ‘tepr’ property value as other properties?

Thank.

An update.
I try to get ‘type’ with a double ‘.type’ and it works but this is a not sense for me.

console.log(hot.getCellMeta(0, 0).type.type);

works fine.

You can explain if it is not a bug and , if yes, why this property works not like others?

Thank you.,

Hi @filippobesana

Can you share the rest of the code, please?

In general when you do not set any cell type the response from getCellMeta(row, column).type will be text (string). Here https://jsfiddle.net/yvL3xqpm/ I add a new type (line 30) and it’s dropdown and this is what I get in the response of the getCellMeta(row, column).type.

ps. please remember that type can be one of the predefined strings

or you can commit type and use cell editor, renderer, and validator (predefined or custom).

Which part of code do you want to see? Server Side/Client side, hot deinifition… please let me know.

If you could share the initialization of the Handsontable instance and (if used) any calls to plugin/core methods after initialization, that would help.