This content has been marked as final.
Show 2 replies
-
1. Re: panelBar / panelBarItem - How expand/collapse on client
dgreenbean Sep 19, 2008 9:56 AM (in response to ekoiti)I just had this same issue. Unfortunately, there's no good way to do this. There is, however, a hack:
<rich:panelBar> <rich:panelBarItem id="panel1" /> <rich:panelBarItem id="panel2" /> <rich:panelBarItem id="panel3" /> </rich:panelBar> <script> // <![CDATA[ function switchToPanel(panel) { if (document.createEventObject) { var event = document.createEventObject(); panel.firstChild.fireEvent('onclick', event); } else { var event = document.createEvent('MouseEvents'); event.initEvent('click', true, true); panel.firstChild.dispatchEvent(event); } } // ]]> </script> <a4j:form> <a4j:commandButton value="test1" oncomplete="switchToPanel(#{rich:element('panel1'});" /> <a4j:commandButton value="test2" oncomplete="switchToPanel(#{rich:element('panel2'});" /> <a4j:commandButton value="test3" oncomplete="switchToPanel(#{rich:element('panel3'});" /> </a4j:form>
It would be really nice if the initialize function in the PanelBar prototype defined $(panelId).component to be equal to the PanelBar instance, similar to how the ProgressBar component works. Until then, the code above is a decent workaround.
-David -
2. Re: panelBar / panelBarItem - How expand/collapse on client
kalomo Nov 24, 2009 9:59 AM (in response to ekoiti)hey,
i tried out your workaround but i get following errorswitchToPanel(#{rich:element('panel1'});" contains invalid expression(s): javax.el.ELException: Error Parsing: switchToPanel(#{rich:element('panel1'});
Do i need something else?