Numeric column: Uncaught TypeError: Cannot read properties of undefined (reading 'languages')

Tags: #<Tag:0x00007efc64f535b8> #<Tag:0x00007efc64f53428>

I have the following javascript that creates a columns object to pass to handsontable initialization:

const columns = columnDataTypes.map((dataType, index) => {
            const columnConfig = {
                readOnly: readonlyColumns[index] // Set readOnly based on readonlyColumns array
            };

            // Apply validation and type settings based on the data type
            switch (dataType) {
                case 'Text':
                    columnConfig.type = 'text';
                    break;
                case 'Numeric':
                    columnConfig.type = 'text';
                    columnConfig.validator = (value, callback) => {
                        // Check for empty values and treat them as valid (you can decide how to handle this)
                        if (value === null || value === '') {
                            callback(true); // Allow empty values
                        } else {
                            callback(!isNaN(parseFloat(value)) && isFinite(value));
                        }
                    };
                    break;
                case 'Date':
                    columnConfig.type = 'date';
                    columnConfig.dateFormat = 'YYYY-MM-DD'; // Specify the date format
                    columnConfig.correctFormat = true; // Ensure correct format is checked
                    columnConfig.validator = (value, callback) => {
                        // Validate if the date is in the correct format
                        const dateFormat = /^\d{4}-\d{2}-\d{2}$/; // YYYY-MM-DD format
                        callback(dateFormat.test(value));
                    };
                    break;
                case 'Boolean':
                    columnConfig.type = 'checkbox'; // Display checkbox for Boolean values
                    break;
                default:
                    columnConfig.type = 'text'; // Default case for unrecognized types
            }
            return columnConfig;
        });

The code above works as expected although columnConfig.type = ‘text’; should be columnConfig.type = ‘numeric’;

The problem is, when i mark any of the columns as numeric the table throws:
Uncaught TypeError: Cannot read properties of undefined (reading ‘languages’)

and then for each subsequent button press:
handsontable.min.js:31 Uncaught TypeError: Cannot read properties of null (reading ‘startColumn’)

the actual code to initialize the table is:

const hot = new Handsontable(container, {
language: ‘en-US’,
data: rowData,
colHeaders: headers,
rowHeaders: true,
contextMenu: true,
columns: columns,
licenseKey: ‘non-commercial-and-evaluation’
});

Why am i getting this error? How does specifying a numeric column type throw random languages doesn’t exist errors? The stack trace makes no sense whatsoever

Hi @danpabsolute

Thank you for contacting us. As this is quite customized implementation it would be best if you could share a code demo where we can replicate the issue. It would be hard to determine such an error without it.

Hi @danpabsolute

As my colleague on a conference this week, I wanted to update the thread before he returns. Did you have time to prepare a demo? If you do not want to share it publicly (here on forum) you can also mail us at support@handsontable.com