Toggle Panels Rendering When Closed (lazy loading help)
shamu25 Jun 25, 2010 4:21 PMI'm using a series of rich:simpleTogglePanels to delay loading parts of my page. I load the first one open, but the rest are rendered
in the closed state. In my first panel, I have an a4j:commandLink to perform an action and rerender the content of the first panel. But,
when the post happens for the a4j:commandLink the content in all the simpleTogglePanels gets rendered even though they are closed.
I'd like to use the closed panels to delay loading of the content. This works when the page is initially shown, but when I click on the link all their content is rendered;
beans are created and subsequent service calls are made. After the page update in the browser, the panels are still in a closed state, but the
a4j:commandLink required extra time because of all the bean creations. Does anyone have suggestions on how to prevent this?
Example Code:
<rich:simpleTogglePanel id="p1"switchType="ajax'
opened="true">
<s:div id="p1_content">
<a4j:commandLink value="Edit"
action="#{my.Bean1.actionMethod}"
reRender="p1_content" />
</s:div>
</rich:simpleTogglePanel>
<rich:simpleTogglePanel id ="p2" switchType="ajax'
opened="false">
<h:outputText value="#{my.Bean2.heavyProcessValue}" />
</rich:simpleTogglePanel>
You can see p2 is in a closed state, I didn't want to call my.Bean2.heavyProcessValue until the user opens p2. This works correctly
when the page is initially shown, but once I select the Edit link in p1 the bean in p2 gets called. This slows down the processing for p1 even though the reRender is scoped to its local div.
I believe this is a bug or my misunderstanding of how the toggle panels work. I have tried setting limitToList on the a4j:commandLInk. And that does work, but I might need to set a message, so I didn't want to use that flag. I thought as long as p2 is
in a closed state it wouldn't render; but this is not the case.
Any help would be appreciated.
Thanks,
Chris