2

我的页面中有两个rich:extendedDataTables。一个是“master”,另一个是“slave”,因为slave中的数据依赖于master中的数据。

主人已经filterBy为它的每一列设置了。我希望能够rerender根据主表中的过滤事件访问从表。

我最接近成功的是尝试点击下面的“返回”按键,但效果不佳:

<rich:hotKey selector="#masterTableEnclosingPanel" key="return" 
    handler="doSomethingA4jFunction()" preventDefault="true" type="onkeyup" /

我正在使用 RichFaces 3.3.3。任何想法都非常受欢迎!


根据 khan 的要求,我正在添加更多的 XHTML 源代码。我正在使用 RichFaces 3.3.3:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:ui="........................">

<f:view>
    <head>
        <meta http-equiv="....................."/>
    </head>
    <body>
    <a4j:form id="my_form">

        <a4j:jsFunction name="handleMasterTableFiltering"
            oncomplete="myCustomFilterColumnsJSFunction()"
            reRender="slaveTablePanel"/>

        <rich:panel id="masterTablePanel">

<!-- MASTER TABLE -->
            <a4j:region id="masterTableEnclosingRegion">
                <rich:extendedDataTable rowKeyVar="rkv"
                    height="284px" width="100%" id="masterTable" rows="10"
                    columnClasses="col" value="#{BackingBean.masterTableModel}"
                    binding="#{BackingBean.masterTable}"
                    selection="#{BackingBean.selectionMasterTable}" var="master"
                    enableContextMenu="false" selectionMode="multi">

                    <a4j:support event="onselectionchange"
                        action="#{BackingBean.handleSelectionMasterTable}"
                        reRender="slaveTablePanel" />

                    <rich:column width="40px" sortBy="#{'ID'}" filterBy="#{'ID'}">
                        <f:facet name="header">
                            <h:outputText value="ID" />
                        </f:facet>
                        <h:outputText value="#{master.id}" id="master_id"/>
                    </rich:column>

                    <rich:column width="120px" sortBy="#{'NAME'}" filterBy="#{'NAME'}">
                        <f:facet name="header">
                            <h:outputText value="Name" />
                        </f:facet>
                        <h:outputText value="#{master.name}" id="master_name" />
                    </rich:column>

                    <rich:column width="140px" sortBy="#{'DESCRIPTION'}" filterBy="#{'DESCRIPTION'}">
                        <f:facet name="header">
                            <h:outputText value="Description" />
                        </f:facet>
                        <h:outputText value="#{master.description}" id="master_desc" />
                    </rich:column>

                </rich:extendedDataTable>
            </a4j:region>
<!-- END MASTER TABLE -->

        </rich:panel>

        <rich:spacer height="10px" />

        <rich:panel id="slaveTablePanel">

<!-- SLAVE TABLE -->
            <rich:panel id="slaveTableEnclosingPanel" 
                    style="height:325px; width:1210px; overflow:auto; border:0px; padding-top:0px;">
                <rich:extendedDataTable rowKeyVar="rkv"
                    height="282px" width="1758px" id="slaveTable" rows="10"
                    columnClasses="col" selectionMode="multi"
                    value="#{BackingBean.slaveTableModel}"
                    selection="#{BackingBean.selectionSlaveTable}"
                    binding="#{BackingBean.slaveTable }"    
                    var="slave" enableContextMenu="false">

                    <a4j:support event="onselectionchange" immediate="true"
                        action="#{BackingBean.handleSelectionSlaveTable}"/>

                    <rich:column width="40px" sortBy="#{'ID'}" filterBy="#{'ID'}">
                        <f:facet name="header">
                            <h:outputText value="ID" />
                        </f:facet>
                        <h:outputText value="#{slave.id}" id="slave_id"/>
                    </rich:column>

                    <rich:column width="120px" sortBy="#{'NAME'}" filterBy="#{'NAME'}">
                        <f:facet name="header">
                            <h:outputText value="Name" />
                        </f:facet>
                        <h:outputText value="#{slave.name}" id="slave_name" />
                    </rich:column>

                    <rich:column width="140px" sortBy="#{'DESCRIPTION'}" filterBy="#{'DESCRIPTION'}">
                        <f:facet name="header">
                            <h:outputText value="Description" />
                        </f:facet>
                        <h:outputText value="#{slave.description}" id="slave_desc" />
                    </rich:column>

                </rich:extendedDataTable>
            </rich:panel>
<!-- END SLAVE TABLE -->

        </rich:panel>

        <rich:hotKey selector="#masterTablePanel" key="return"
            handler="handleMasterTableFiltering()"
            preventDefault="true" type="onkeyup" />

    </a4j:form>

    </body>
</f:view>
</html>
4

2 回答 2

1

解决方案是将slaveTablePanel放入:reRendermasterTablePanel

<rich:extendedDataTable
    id="masterTable" ..........
    reRender="slaveTablePanel" >

问候 :)

于 2013-04-30T13:48:22.523 回答
0

尝试将以下内容添加到主表:

<a4j:support event="onkeyup"
             oncomplete="myCustomFilterColumnsJSFunction()"
             reRender="slaveTablePanel" />
于 2013-04-15T12:13:44.960 回答