Reputation: 113
I am working with Sencha Architect 3.1 , and i am facing an issue with Tree Panel collapse.
There is a view port with Border layout .
In the west region there is one Tree Panel and Panel with same width.
I have an event listener for click of leaf node in a Tree Panel in which i will give this.collapse(),
but when the Tree Panel is expanded next time it moves towards the right.
Here is a sample fiddle which i have done which has the same problem.
Please help me to find solution for this problem.
Upvotes: 0
Views: 315
Reputation: 313
The big problem here is that you are attempting to collapse the TreePanel.
Let's take this in steps as to better understand the issue. There are 2 different options for the user to see the Tree Panel in your example.
The first would be to click the expand button tool within the header on the left side. But in this case the expand/collapse button tool has been hidden. Thus this way is not possible.
The second is to click anywhere(else) within the header along the left side.
The above methods for the user result in very different behaviors. If the first option were used, the panel would "expand", resulting in the other panels being pushed to the right so that the Tree Panel could be shown. If the second option were used, the panel would "float" over the existing panels.
I suggest you set hideCollapseTool: true
and give the these two options a try to see for yourself.
With with knowledge, it should be easy to understand that performing this.collapse()
is the incorrect way to "hide" the Tree Panel, because the panel was never expanded. Because it was not expanded, attempting to collapse the panel results in the x location of the Tree Panel to get offset incorrectly (Sencha should have error checking here, but obviously not).
So, the answer to question is to simply change this.collapse()
to this.hide()
. Unfortunately, there is no good way to tell the panel to unfloat itself and animate away. Either I don't know which method to call or Sencha has overlooked this issue.
I hope this was clear.
Upvotes: 1