Reputation: 1343
Other than the obvious of using something like a scope variable in a panel's computed rendered property, is there some other way to hide a panel?
Something like getCompoent("panel1").hide()
which I tried but did not appear to work,
Upvotes: 0
Views: 1866
Reputation: 827
If extlib available check out xe:dynmaicPanel control ... very efficient as only the displayed panel is added to the component tree ... with the rendered property approach the panel is still added to the component tree even when rendered=false.
Also can code dynamic content display using a Simple Action, Client-side or Server-side JavaScript.
... via CSJS ...
XSP.showContent("#{id:dynamicContent1}","keyToPanel1")
... via SSJS ...
var dc=getComponent("dynamicContent1");
dc.show("keyToPanel1")
or SS simple action ...
<xe:changeDynamicContentAction
for="dynamicContent1" facetName="keyToPanel1">
</xe:changeDynamicContentAction>
Upvotes: 1
Reputation: 21
Have you tried the Switch control in the Extension Library? Not sure if that would be helpful for what you are trying to accomplish.
Upvotes: 0
Reputation: 8086
The correct method is getComponent("id").setRendered(false). You can show it again via getComponent("id").setRendered(true).
Upvotes: 6
Reputation: 1399
You can achieve this by using the following code:
var c = getComponent("YOURPANELNAMEHERE")
c.toggle()
toggle is what you are looking for (instead of show/hide).
Upvotes: 0