RichFaces列排序影响页面中的多个DataTable

时间:2015-05-26 16:11:43

标签: jquery jsf richfaces

在我的页面中,我有两个简单的rich:extendedDataTable表,每个表都有一个可排序的列,默认情况下数据按升序sortOrder排序。当我单击可排序列以在一个表中更改sortOrder方向时,两个表中的数据将被重新排序。

<h:form>
    <a4j:outputPanel id="id-healthPanel" style="float : left" layout="block"  ajaxRendered="true">
        <rich:panel styleClass="panelBackground" style="width:622px; height: 350px;">
            <rich:extendedDataTable id="policyHealthList" value="#{complianceMonitorManagedBean.allPendingHealthPolicies}" var="healthItem"
                  rows="#{complianceMonitorManagedBean.displayRows}" >

                  <f:facet name="header">
                      <h:outputText value="Health Policies with Missing Instructions" />
                  </f:facet>

                  <rich:column headerClass="alignLeft" width="60px">
                      <f:facet name="header">Policy</f:facet>
                      <h:outputText value="#{healthItem.policy}" />
                  </rich:column>

                  <rich:column headerClass="alignLeft" width="110px">
                      <f:facet name="header">Plan Code</f:facet>
                      <h:outputText value="#{healthItem.planCode}" />
                  </rich:column>

                  <rich:column sortOrder="#{complianceMonitorManagedBean.sortOrder}" sortBy="#{healthItem.sortKey}" headerClass="alignCenter" width="70px">
                      <f:facet name="header">Date</f:facet>
                      <h:outputText value="#{healthItem.userDate}" />
                  </rich:column>

                  <f:facet name="footer">
                     <rich:dataScroller align="left" for="policyHealthList" maxPages="20"
                                    stepControls="hide" boundaryControls="hide" fastControls="hide" id="sc" />
                  </f:facet>

            </rich:extendedDataTable>

        </rich:panel>
    </a4j:outputPanel>

    <a4j:outputPanel id="id-lifePanel" style="float : left;" layout="block"  ajaxRendered="true">
        <rich:panel styleClass="panelBackground" style="width:729px; height: 350px;">

            <rich:extendedDataTable id="policyLifeList" value="#{complianceMonitorManagedBean.allPendingLifePolicies}" var="lifeItem" 
                rows="#{complianceMonitorManagedBean.displayRows}">
                  <f:facet name="header">
                      <h:outputText value="Life Policies with Missing Instructions" />
                  </f:facet>

                <rich:column headerClass="alignLeft" style="width:50px">
                      <f:facet name="header">Policy</f:facet>
                      <h:outputText value="#{lifeItem.policy}" />
                  </rich:column>

                   <rich:column headerClass="alignLeft" style="width:50px">
                      <f:facet name="header">Plan Code</f:facet>
                      <h:outputText value="#{lifeItem.planCode}" />
                  </rich:column>

                <rich:column headerClass="alignCenter" sortOrder="#{complianceMonitorManagedBean.sortOrder}" sortBy="#{lifeItem.sortKey}" style="width:50px">
                      <f:facet name="header">Date</f:facet>
                      <h:outputText value="#{lifeItem.userDate}" />
                  </rich:column>

                  <f:facet name="footer">
                     <rich:dataScroller align="left" for="policyLifeList" maxPages="20"
                                    stepControls="hide" boundaryControls="hide" fastControls="hide" id="sc2" />
                  </f:facet>
            </rich:extendedDataTable> 

        </rich:panel>
    </a4j:outputPanel>

</h:form>

我想我需要将每个表放在一个单独的区域中,就像<a4:4region>标签一样,但到目前为止,我只是对我选择的表进行排序是不成功的。我应该使用<rich:jQuery click(function()...>来处理这个事件吗?任何人都可以建议如何正确地使排序/点击事件仅适用于我选择的表格吗?

我正在使用RichFaces 4.3.4-Final,JSF 2.2.6

0 个答案:

没有答案