重新渲染丰富:tab contnet
我尝试为我的应用程序提供 web2.0 支持。为此,我想提供可以动态包含多个选项卡的 rich:tabpanel。用户可以添加和删除选项卡。为此,我使用 c:foreach 来表示rich:tab 列表。该选项卡包含 rich:panel 列表,其中包含详细信息。该面板仅包含简短内容。通过单击“阅读更多”链接,用户可以阅读完整内容。为此,我需要重新渲染 a4j:outputpanel包含 rich:panel 列表。但我不能这样做。因为我使用了 c:freach 来渲染选项卡列表。所以我无法获取包含 rich:panels 列表的 a4j:outputpanel 的确切 id .a4j:outputpanel 不允许 el 表达式。我的代码片段如下,
<c:forEach items="#{Home.tabList}" var="homeBean" varStatus="status">
<el:define value="${status.count}" var="rowIndex"/>
<rich:tab id="homeTab" label="#{homeBean.header}"
name="#{homeBean.header}" switchType="client"
onlabelclick="coinSliderFunction('coin-slider#{rowIndex}')">
<a4j:outputPanel id="subHeaderPanel">
<h:panelGrid columns="3" cellpadding="3" cellspacing="3"
id="detailGrid" rendered="#{!Home.subHeaderDetailedContentPanelRendered}"
columnClasses="layoutContentColumnClass,
layoutContentColumnClass,layoutContentColumnClass">
<%--SubHeader List--%>
<c:forEach items="#{homeBean.subHeaderBeanList}" var="subHeaderBean" varStatus="subHeaderStatus">
<rich:panel header="#{subHeaderBean.header}" id="subHeaderPanels">
<h:outputText id="outputText" value="#{subHeaderBean.briefContent}" escape="false"/>
<a4j:commandLink value="Read More" id="readMoreLink"
action="#{Home.navigationHandler}" reRender="subHeaderPanel">
<a4j:actionparam name="headerActionParam" value="#{homeBean.header}" assignTo="#{Home.headerName}"/>
<a4j:actionparam name="subHeaderActionParam" value="#{subHeaderBean.header}" assignTo="#{Home.subHeaderName}"/>
</a4j:commandLink>
</rich:panel>
</c:forEach>
</h:panelGrid>
<%--SubHeader Detail Panel--%>
<h:panelGrid rendered="#{Home.subHeaderDetailedContentPanelRendered}" id="subHeaderGrid">
<h:outputText id="detailedContent" value="#{Home.subHeaderDetailedContent}" escape="false"/>
<f:verbatim><center></f:verbatim>
<a4j:commandLink id="backLinks" value="#{platform.backButtonLabel}"
action="#{Home.backButtonAction}"
reRender="leftOutputPanel"/>
<f:verbatim></center></f:verbatim>
</h:panelGrid>
</a4j:outputPanel>
</rich:tab>
</c:forEach>
我怎样才能实现这一点?请帮助我。
I have try to provide the web2.0 support for my application.For that i wants to provide the rich:tabpanel that can contains number of tabs dynamically.User can add and remove the tabs.For that i use c:foreach for represent the list of rich:tab.The tab contains list of rich:panel contains the details.The panel contains only brief content.By clicking the read more link,the user can read full content.For that i need to rerender the a4j:outputpanel which contains the list of rich:panel.But i can't do this.Because i have used c:freach for render the list of tabs.So i can't get the exact id of the a4j:outputpanel which contains list rich:panels.The a4j:outputpanel doesnot allowed the el expressions.My code snippet is below,
<c:forEach items="#{Home.tabList}" var="homeBean" varStatus="status">
<el:define value="${status.count}" var="rowIndex"/>
<rich:tab id="homeTab" label="#{homeBean.header}"
name="#{homeBean.header}" switchType="client"
onlabelclick="coinSliderFunction('coin-slider#{rowIndex}')">
<a4j:outputPanel id="subHeaderPanel">
<h:panelGrid columns="3" cellpadding="3" cellspacing="3"
id="detailGrid" rendered="#{!Home.subHeaderDetailedContentPanelRendered}"
columnClasses="layoutContentColumnClass,
layoutContentColumnClass,layoutContentColumnClass">
<%--SubHeader List--%>
<c:forEach items="#{homeBean.subHeaderBeanList}" var="subHeaderBean" varStatus="subHeaderStatus">
<rich:panel header="#{subHeaderBean.header}" id="subHeaderPanels">
<h:outputText id="outputText" value="#{subHeaderBean.briefContent}" escape="false"/>
<a4j:commandLink value="Read More" id="readMoreLink"
action="#{Home.navigationHandler}" reRender="subHeaderPanel">
<a4j:actionparam name="headerActionParam" value="#{homeBean.header}" assignTo="#{Home.headerName}"/>
<a4j:actionparam name="subHeaderActionParam" value="#{subHeaderBean.header}" assignTo="#{Home.subHeaderName}"/>
</a4j:commandLink>
</rich:panel>
</c:forEach>
</h:panelGrid>
<%--SubHeader Detail Panel--%>
<h:panelGrid rendered="#{Home.subHeaderDetailedContentPanelRendered}" id="subHeaderGrid">
<h:outputText id="detailedContent" value="#{Home.subHeaderDetailedContent}" escape="false"/>
<f:verbatim><center></f:verbatim>
<a4j:commandLink id="backLinks" value="#{platform.backButtonLabel}"
action="#{Home.backButtonAction}"
reRender="leftOutputPanel"/>
<f:verbatim></center></f:verbatim>
</h:panelGrid>
</a4j:outputPanel>
</rich:tab>
</c:forEach>
How can i achieve that?Please help me.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
由于您无法确定 forEach 循环中呈现的 tabe 面板的 id,因此您必须重新呈现 panelGrid detailGrid。请注意将选项卡上显示的所有值缓存在托管 bean 中。如果这样做,则不需要数据库调用,并且所有选项卡的重新呈现速度都会很快。
Since you can not determine the id of the tabe panels rendered in the forEach loop you have to rerender the panelGrid detailGrid. Take care to cache all values shown on the tabs in your managed beans. If you do so no database call is required and rerendering of all tabs is fast.