[GH #7228] Cannot read property 'indicator' of undefined

Tags: #<Tag:0x00007f8b28c28a48> #<Tag:0x00007f8b28c288e0>

Hello,
My table doesn’t fill as I scroll horizontally. The error I get is:
handsontable.full.min.js:34 Uncaught TypeError: Cannot read property 'indicator' of undefined

Demo: https://zoziologie.raphaelnussbaumer.com/birdingwithebird/#

Could you help me trouble shoot the issue?

Hi @rafnuss

we had a similar report here https://github.com/handsontable/handsontable/issues/7182 but it was not the issue with Handsontable itself.
Can you share a simplified demo where the issue can be replicable (I propose JSFiddle, as the code is editable)?

Hi,
Thanks for your quick reply. It is indeed related to the columnsorting plugin. Also similar to DblClick router redirect " TypeError: Cannot read property 'indicator' of undefined".
When I remove the plugin everything work fine. I just don’t know how to troubleshoot a problem like that.
It’s a bit difficult to put the code in a JSFiddle, but if you have no idea what I could try, I’ll do it tomorrow.
Thanks

I managed to get it work by removing columnSorting in the setting and initiate the plugin after with
hot.getPlugin('columnSorting').enablePlugin()

Probably not the best solution but works for me!

That should not be required. I recommend building the JSFiddle demo. I will do my best to help you solve this issue.

I have the same problem with columnSorting plugin. Tried to make a demo, but in demo it was working OK

Hi @dan

It seems that the issue relates to other settings or script queue. I recommend commenting out settings one after another.

I’m seeing the same error with v8.0.0 if configuring both multiColumnSorting and NestedHeaders. Error fires on subsequent calls to updateSettings().

Edit: just checked and columnSorting exhibits the same issue

Hi @andrew.jerrim
Would you be able to send me a demo where this issue is replicable?

Here you go: https://jsfiddle.net/andrew_j/s817zt4k/109/

It took me a while to reproduce the error as it needs a second nested group defined before it triggers.

Adding the following before line 61243 of handsontable.full.js (in onAfterGetColHeader) seems to work around the issue:

if (pluginSettingsForColumn == undefined) return;

Thank you @andrew.jerrim
I was able to replicate the issue thanks to your demo.

It looks like the issue is also present if we declare to remove the indicator

columnSorting: {
    indicator: false
},

for columnSorting and multiColumnSorting.

I’ve reported the issue here https://github.com/handsontable/handsontable/issues/7228
It seems that it happens when data is empty. We can call empty updateSettings({}) to replicate the issue. We do not need nestedHeaders.

I will update you as soon as we get this issue solved.

OK, thanks!

I am also facing this same issue. Is this resolved now ?

Hi @shivaraj.durairaj the mentioned issue https://github.com/handsontable/handsontable/issues/7228 is under review. We should have it done within 2 weeks.

Hey Aleksandra - it looks like the issue has been solved and merged to develop. Are you able to share any information on timing of the release which contains this fix? I wasn’t sure if the 2 weeks you mentioned in the previous post applied to fixing it, or making the fix available in a release?

Thanks to you and the team for addressing it!

Hi @andrew.jerrim today we have a code freeze. It means that we won’t merge anything new but will take that time to test the branch. Release is planned for the 1st of October.

1 Like

Good afternoon! @aleksandra_budnik This issue is already solved ?

Hi @phelipegm

yes, the https://github.com/handsontable/handsontable/issues/7228 issue was solved for v8.1.0

Here are the release notes for that version https://handsontable.com/docs/8.1.0/tutorial-release-notes.html

In JavaScript almost everything is an object, null and undefined are exceptions. This error occurs when a property is read or a function is called on an undefined variable. Undefined means that a variable has been declared but has not been assigned a value. In JavaScript, properties and functions can only belong to objects. Since undefined is not an object type, calling a function or a property on such a variable causes the TypeError: [Cannot read property] of undefined.

If you are not sure a variable that will always have some value, the best practice is to check the value of variables for null or undefined before using them. To avoid getting these types of errors, you need to make sure that the variables you are trying to read do have the correct value. This can be done in various ways. You can do if checks before dealing with objects whose values are bound to change:

if (myVar !== undefined) {
    ...
}

Or

if (typeof(myVar) !== 'undefined') {
    ...
}