Search code examples
extjsextjs4extjs4.1extjs-mvc

Hiding a component within a Border-Layout region programatically


I have a border Layout with let's say two regions; center and west. The westregion is added with the splitter param and is collapsible. Now I have a toolbar from which I want to hide/show the west region. I've solved this by calling the toggleTargetCmp() method of the splitter. Well I know, this is a private method and should not be used, but I found no other way to archive this. So far so good. All this works.

But now I want to hide the splitter & placeholder (I fetch the placeholder ownet by using the getCollapseTarget() method of the splitter) if the button in the toolbar gets clicked. I tried it with setVisible(false) which works for the splitter but it didn't work well for the placeholder... after a deeper look onto the placeholder instance I can tell that it is set to hidden: true but it uses the hideMode: 'offsets' by default plus hiddenAnchestor: false which is not documented in the API.

Based on the API docu for hideMode I tried to set it to 'display' before calling setVisible(false) without any luck, the placeholder still stays visible.

So how can I hide the placholder, too. Or is there even a better way to archive this?


Solution

  • Have you tried hide method? It works exactly as you describe - hides region and splitter. In my project I do it like this:

    panel.hide();
    

    where panel is one of borderPanel items.