The getObject api is then called again with the correct id to get the new chart based on what was selected. The problem begins when we try to toggle back to a chart that has already been displayed. An exception is thrown when the internal engine tries to set the layout for the control to display.
TypeError: Cannot read property 'qType' of undefined
at Object.f.setLayout (/resources/assets/client/client.js??1499952235400:69)
at a.c [as fn] (/resources/assets/client/client.js??1499952235400:69)
This is happening because the getLayout call (in the qlik js code) does not return the correct data. (Basically returns nothing).
If I take the destroySessionObject call out everything appears to work as expected.
I have also converted the code to use the visualization api instead. Using the close method of the QVisualization in place of the destroySessionObject and the app.visualization.get in place of getObject() and I see the same behavior.
So is the call to destroy or close necessary? (I cannot find any qlik documents stating you should always do this.)
Does this sound like a potential bug in the new version or is this extension not doing things correctly? (I am new to qlik development)
(There is also an example qvf at the above github address that will demonstrate the same behavior. The ShowHide: Buttoms sheet is a good example)