Ajax呈现不同表单中的表
从Ajax呈现不同表单中的表,ajax,jsf-2,richfaces,Ajax,Jsf 2,Richfaces,从中选择日期时,我在呈现数据表时遇到问题。我使用进行渲染,但没有效果。以下是代码示例: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http:
中选择日期时,我在呈现数据表时遇到问题。我使用
进行渲染,但没有效果。以下是代码示例:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:rich="http://richfaces.org/rich"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:composite="http://java.sun.com/jsf/composite">
<rich:panel header="#{lang.reportPanelHeader}" id="panel" rendered="#{navigation.reportRendered}" width="700px" style="margin-left:250px">
<a4j:status onstart="#{rich:component('statPane')}.show()" onstop="#{rich:component('statPane')}.hide()" />
<h:form id="data_table_form">
<rich:dataTable value="#{validateReportAction.reportList}" var="report" iterationStatusVar="it" id="data_table" rows="5">
<rich:column>
<f:facet name="header">#</f:facet>
#{it.index + 1}
</rich:column>
<rich:column>
....
</rich:column>
<f:facet name="footer">
<rich:dataScroller page="#{validateReportAction.page}" />
</f:facet>
</rich:dataTable>
</h:form>
<rich:popupPanel id="statPane" autosized="true" style="border: none; background-color: #e6e6e6;">
....
</rich:popupPanel>
<div id="bottom">
<h:form id="calendarForm">
<div id="left">
<div class="input" id="test_cal">
<rich:calendar
dataModel="#{calendarModel}"
value="#{validateReportAction.selectedDate}"
boundaryDatesMode="scroll"
required="true"
requiredMessage="#{lang.dateRequiredMsg}"
mode="ajax"
id="date"
datePattern="dd.MM.yyyy"
popup="false">
<a4j:ajax event="change" render="@all"/>
</rich:calendar>
<span class="error_msg">
<rich:message for="date" ajaxRendered="true"/>
</span>
</div>
</div>
</h:form>
</div>
</rich:panel>
</ui:composition>
#
#{it.index+1}
....
....
我被迫在
中的日历中使用@all,但我只想呈现数据表
。如何执行此操作?由于它位于不同的命名容器父级中,您需要通过其绝对客户端ID来引用它。要找到它,请在webbrowser中打开页面。右键单击并查看源。找到由
生成的HTML
元素。它看起来像这样:
<table id="data_table_form:data_table">
另见:
顺便说一下,标记中存在语法错误。开始和结束标记不匹配。但这已经在查看页面时引发了Facelets异常。请小心准备问题中的代码片段:):>我会记住这一点的,谢谢:-)即使在将前缀添加为:后,它对我也不起作用Id@Harshal_Kalavadiya:那么你就不会有与OP相同的问题了。请开始对这件事进行更一般的解释。
<a4j:ajax event="change" render=":data_table_form:data_table" />