-
1. Re: rich:simpleTogglePanel - Open/close via a4j:commandLink
scottaii Mar 4, 2010 4:17 AM (in response to scottaii)Bump, i posted this late -
2. Re: rich:simpleTogglePanel - Open/close via a4j:commandLink
ilya_shaikovsky Mar 4, 2010 5:17 AM (in response to scottaii)1 of 1 people found this helpful1) clientSide solution
There are no client side api documented for this components but you could check components script and call the methods on components which will handle switching.
E.g. for tabPanel it would be
RichFaces.switchTab = function(pane,tab,value)
2) Ajax solution.
It would be much more simplier to manage this via ajax. You just need bind opened attribute of simple toggle panel and selectedTab attribute of tabPanel to some controller bean properties and manage them as you need with further re-rendering.
-
3. Re: rich:simpleTogglePanel - Open/close via a4j:commandLink
scottaii Mar 4, 2010 6:57 AM (in response to ilya_shaikovsky)Thank you for the reply,
I am trying the AJAX approach.
My first step is trying to pop the rich:simpleTogglePanel up via a button.<a4j:commandLink
value="open"
action="#{bean.setToggle(true)}"
ajaxSingle="true"
reRender="footerTogglePanel"
/>
My simpleTogglePanel looks like this:
<rich:simpleTogglePanel
id="footerTogglePanel"
switchType="client"
label="TogglePanel"
opened="#{bean.isToggle()}">
// Stuff contained in the toggle panel here //
<rich:simpleTogglePanel/>
Does this look right?
-
4. Re: rich:simpleTogglePanel - Open/close via a4j:commandLink
scottaii Mar 4, 2010 9:23 AM (in response to ilya_shaikovsky)Doesnt seem to be working,
When i try to reRender the simpleTogglePanel after pressing the button (and setting the opened=true through a bean).
The info inside the simpleTogglePanel gets re-rendered, but the panel its-self does not pop-up
Any suggestions? -
5. Re: rich:simpleTogglePanel - Open/close via a4j:commandLink
ilya_shaikovsky Mar 5, 2010 6:47 AM (in response to scottaii)which version used? try please latest CR as we had such issues in the past. -
6. Re: rich:simpleTogglePanel - Open/close via a4j:commandLink
scottaii Mar 8, 2010 9:09 AM (in response to ilya_shaikovsky)Cheers for all the help,
i opened the rich:simpleTogglePanel using:
SimpleTogglePanelManager.toggleOnClient('click ','panelid');
and then opened the rich:tab using:
RichFaces.switchTab('tabPanelId','tabLabel','tabId')
Hope this helps somebody else. -
7. Re: rich:simpleTogglePanel - Open/close via a4j:commandLink
scottaii Mar 9, 2010 4:28 AM (in response to scottaii)Just a quick question.
Is there a way of telling which state the toggle panel is in? I.E is it opened or closed?
Is there anyway of accessing this?
Thank you -
8. Re: rich:simpleTogglePanel - Open/close via a4j:commandLink
scottaii Mar 9, 2010 5:24 AM (in response to scottaii)Answering my own question.
You can use :
SimpleTogglePanelManager.panels.get('Id').status
to find the status of the rich:simpleTogglePanel e.g is it expanded or collapsed.
In my example, i wanted to be able to open the togglePanel via a button, or clicking on the panel
but to ONLY beable to close it via the panel (not the button)
My JS looked like this:
function togglePanelPopUp() {
if(SimpleTogglePanelManager.panels.get('Id').status == "false"){
SimpleTogglePanelManager.toggleOnClient('click ','Id');
}
I then switched to a particular tab using:
RichFaces.switchTab('tabPanelId','TabLabel','TabId')
My a4j:commandLink looked like:
<a4j:commandLink value="OpenTogglePanelThenOpenTab"
ajaxSingle="true"
immediate="true"
onclick="togglePanelPopUp(); RichFaces.switchTab('tabPanelId','TabLabel','TabId')"
reRender="Panelform"/>
Again i hope this helps other people,
Cheers,
Scott