Please clarify what exactly doesn't work?
Huh, I thought that you insist on samples that you can copy/paste it in Visual Studio and immediately reproduce problem. Nevertheless I'll explain problem more clearly:
- Start sample
- Select one of the panels (for example, Astrology)
- Select one node in tree (for example Sagittarius)
- Exit sample
- Start sample again
- Now, situation is that sample correctly show last selected panel when I left application, but it doesn't select a node
Does GetState save a correct internalId?
Does the StateRestore try to select the node? What happens in the StateRestore handler?
No State restore does not select the node. I don't quite understand your second question. Let's go line by line:
this.collapsed = state.collapsed;
Here I set collapsed state of panel. It works
var record = this.getStore().getNodeById(state.selected)
Here I get correct node, based on selected property saved in get state.
Here I'm trying to select that node, but it does not happen (although I've got correct node).
Are you sure to rely on a Node's internalId if no Node's ID is set up?
You're right, NodeID is set in second panel, I forgot to set it in first, but for previously mentioned test case it does not have impact.
Generally I would like is, as you said that there a number of solutions for this problem, your opinion am I doing it on the right way? Maybe there are some more elegant solutions. For example you saw that I set same pieces of code for both accordion panels, which is not so nice especially from perspective of supporting that in future. Could it be done better, with less code and how? Also if this is the only way, why selecting node is not working?