使用rich:datascroller更改页面后,actionListener无法在rich:dataTable中工作

时间:2014-05-12 13:03:30

标签: java jsp richfaces

在我的java项目中,我使用richfaces 3.3并尝试使用rich:dataTable组件显示表。

<ui:composition template="/main-template.jspx"
                xmlns="http://www.w3.org/1999/xhtml"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:rich="http://richfaces.org/rich"
                xmlns:a4j="http://richfaces.org/a4j"
                xmlns:ui="http://java.sun.com/jsf/facelets">

<ui:define name="content">

<script type="text/javascript" src="../js/swfobject1_4.js"></script>
<script type="text/javascript" src="#{request.contextPath}/js/slotsHistory.js"></script>
<script type="text/javascript" src="#{request.contextPath}/js/jquery-1.10.2.js"></script>
<link rel="stylesheet" type="text/css" href="#{request.contextPath}/css/slotsHistory.css"/>
<script>
    jQuery.noConflict();
</script>

<f:loadBundle basename="messages" var="msgs"/>
<a4j:form id="gameHistory">
    <h:panelGroup>
        <h2><h:outputText value="#{msgs['game.history.header']}"/></h2>
    </h:panelGroup>

        <h:panelGrid>
            <rich:datascroller id="topScroller"
                               for="gameHistoryTable"
                               maxPages="5"
                               reRender="bottomScroller, gameHistoryTable"
                               rendered="#{casinoGameHistoryController.gameSession.rowsCount > 10}">
                <f:param name="gameSession" value="#{casinoGameHistoryController.gameSession.id}"/>
            </rich:datascroller>
            <rich:dataTable id="gameHistoryTable"
                            var="viewSlotGameHistory"
                            rows="#{casinoGameHistoryController.pageSize}"
                            value="#{casinoGameHistoryController.tableList}"
                            styleClass="tbl" rendered="#{casinoSessionSearchController.showTable}">
                <f:facet name="header">
                    <rich:columnGroup>
                        <rich:column>
                            <h:outputText value="#{msgs['game.history.table.column.flashContent']}"/>
                        </rich:column>
                    </rich:columnGroup>
                </f:facet>

                <rich:column>
                        <a4j:commandButton value="Detailed"
                                       actionListener="#{casinoGameHistoryController.takeSelectionListener}"
                                       oncomplete="#{rich:component('detailedHistoryPopup')}.show()" immediate="true"
                                       reRender="detailedHistoryForm">
                            <f:setPropertyActionListener target="#{casinoGameHistoryController.currentViewGameHistory}" value="#{viewSlotGameHistory}" />
                            <f:param name="gameSession" value="#{casinoGameHistoryController.gameSession.id}"/>
                            <f:attribute name="viewSlotGameHistory" value="#{viewSlotGameHistory}"/>
                        </a4j:commandButton>
                </rich:column>
            </rich:dataTable>

            <rich:datascroller id="bottomScroller"
                               for="gameHistoryTable"
                               maxPages="5"
                               reRender="topScroller, gameHistoryTable"
                               rendered="#{casinoGameHistoryController.gameSession.roundsCount > 10}">
                <f:param name="gameSession" value="#{casinoGameHistoryController.gameSession.id}"/>
            </rich:datascroller>
        </h:panelGrid>

</a4j:form>

<rich:modalPanel id="detailedHistoryPopup" onshow="showDetailed();" onresize="resizeWindow();" width="550" height="550" style="overflow-y:auto;">
        <f:facet name="header">
            <h:outputText value="#{msgs['game.history.detailedHistory']}"/>
        </f:facet>
        <rich:panel>
            <a4j:form id="detailedHistoryForm" ajaxSubmit="true" style="text-align: center;">
                <div id='historyContainer'></div>
                <h:outputText id="json" value="#{casinoGameHistoryController.json}"/>
                   <a4j:commandButton value="#{msgs['game.history.close']}"
                                      oncomplete="#{rich:component('detailedHistoryPopup')}.hide()"/>
            </a4j:form>
        </rich:panel>
</rich:modalPanel>

</ui:define>
</ui:composition>

我的bean有Request范围。代码如下:

public class CasinoGameHistoryController{

public String getJson(){
    if (currentViewGameHistory == null){
        return null;
    }
    return currentViewGameHistory.getJson();
}

public void setCurrentViewGameHistory(ViewSlotGameHistory currentViewGameHistory) {
    this.currentViewGameHistory = currentViewGameHistory;
}
}

点击按钮&#34;详细&#34;在表格中打开带有详细信息的模态窗口。

打开第一页时效果很好。我通过actionListener,检测当前视图并使用它。 但当我进入第二个(和其他)页面并单击按钮&#34;详细&#34;时,actionListener不起作用,模态窗口为空。

我真的不知道它是怎么回事。

解释为什么会发生这种情况会有用。

0 个答案:

没有答案
相关问题