Calling CollapseAll manually throws an exception

Tags: #<Tag:0x00007efc61e65500>

Hello,

I have defined a collapsable columns that works perfectly but now I want the columns to be collapsed at startup.
To do so I added the following call after the Handsontable object creation:

hot.getPlugin('collapsibleColumns').collapseAll()

This doesn’t work and throws an exception. We are using the PRO version 1.3.2, you can reproduce this by adding the precedent call into your JsFiddle sample for this functionality.

Stack trace excerpt:
Error: this.colspanArray[level] is undefined [167]</<.getNestedParent@http://localhost:3000/bower_components/handsontable-pro/dist/handsontable.full.js:26342:9 [167]</<.getChildHeaders@http://localhost:3000/bower_components/handsontable-pro/dist/handsontable.full.js:26360:27 [117]</<.markSectionAs@http://localhost:3000/bower_components/handsontable-pro/dist/handsontable.full.js:21368:26 [117]</<.toggleAllCollapsibleSections/</<@http://localhost:3000/bower_components/handsontable-pro/dist/handsontable.full.js:21405:11 objectEach@http://localhost:3000/bower_components/handsontable-pro/dist/handsontable.full.js:10676:11 [117]</<.toggleAllCollapsibleSections/<@http://localhost:3000/bower_components/handsontable-pro/dist/handsontable.full.js:21404:9 objectEach@http://localhost:3000/bower_components/handsontable-pro/dist/handsontable.full.js:10676:11 [117]</<.toggleAllCollapsibleSections@http://localhost:3000/bower_components/handsontable-pro/dist/handsontable.full.js:21403:7 [117]</<.collapseAll@http://localhost:3000/bower_components/handsontable-pro/dist/handsontable.full.js:21415:5

Hi @eric.gaspard
Unfortunately your demo is empty could you fill it with needed code?

Hello @aleksandra_budnik

As I said, I used the JsFiddle listed on the Collapsing demo and added the collapseAll call which reproduces my problem.

From what I saw in debugging, the negative row index used in the collapsibleColumns setting is passed as is to the nestedHeaders plugin which do not compute a correct index to use for its internal colspanArray.

Thanks and regards.

Yes, thank you @eric.gaspard
Please give me some time to check this behavior.

Please do, I used a workaround with hiddenColumns to accomplish what I want but this is a little glitchy : the toggle button is still in “collapse” position whereas the columns are already hidden. Thus requiring the user to click two times to expand the columns.

@eric.gaspard, it seems like there is a problem with collapseAll indeed. I’ll add it to our TODO list, and will let you know when it’s fixed in this thread.

Thanks for noticing it!

Here’s a demo: http://jsfiddle.net/handsoncode/97ewdzgr/
With version 1.9.1 we are getting

Hi @eric.gaspard

Please test the example: http://jsfiddle.net/handsoncode/6b8z69nb/
We have fixed this issue in the latest version.