Primefaces datalist ajax-pagination对话框未更新

时间:2012-07-05 04:43:51

标签: dialog primefaces datalist

我正在尝试使用primefaces here的primefaces对话框更新方法,并且我用bean替换了bean及其方法。

这就是我做的

<?xml version='1.0' encoding='UTF-8' ?>
<!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="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui" 
      xmlns:c="http://java.sun.com/jsp/jstl/core">
    <h:head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <link rel="stylesheet" type="text/css" href="../Styles/homepage-style.css" />
        <link rel="stylesheet" type="text/css" href="../Styles/profile.css" />
        <title>Shadi Bandhan | We find the best match for you</title>
    </h:head>

    <h:body>

        <h:form id="form">  

            <p:dataList value="#{messagesManagedBean.userInboxMsgs}" var="msg" id="cars"  
                        paginator="true" rows="5"
                        paginatorTemplate="{PreviousPageLink} {CurrentPageReport} {NextPageLink} {RowsPerPageDropdown}"  
                        rowsPerPageTemplate="5,10,15" type="none">  

                <f:facet name="header">  
                    Cars  
                </f:facet>  

                <p:commandButton icon="ui-icon-search" update=":form:carDetail" oncomplete="carDialog.show()" title="View Detail">  
                    <f:setPropertyActionListener value="#{msg}" target="#{messagesManagedBean.selectedMessage}" />  
                </p:commandButton>  

                <h:outputText value="#{msg.message}, #{msg.userFullname}" style="margin-left:10px" />  
                <br />  
            </p:dataList>  

            <p:dialog header="Car Detail" widgetVar="carDialog" modal="true" showEffect="fade">  
                <p:outputPanel id="carDetail" style="text-align:center;" layout="block">  


                    <h:panelGrid  columns="2" cellpadding="5">  
                        <h:outputLabel for="modelNo" value="Message: " />  
                        <h:outputText id="modelNo" value="#{messagesManagedBean.selectedMessage.message}" />  

                        <h:outputLabel for="year" value="Full name: " />  
                        <h:outputText id="year" value="#{messagesManagedBean.selectedMessage.userFullname}" />  

                        <h:outputLabel for="color" value="User Id: " />  
                        <h:outputText id="color" value="#{messagesManagedBean.selectedMessage.userId}" style="color:#{tableBean.selectedCar.color}"/>  
                    </h:panelGrid>  
                </p:outputPanel>  
            </p:dialog>  

        </h:form> 



    </h:body>
</html>

它会打开对话框但不显示值。 (对话框没有更新) * 注意 *之前,当我使用ui:repeat而不是datalist时,f:param方法很好。

由于

2 个答案:

答案 0 :(得分:1)

<h:form id="form">  

            <p:dataList value="#{tableBean.cars}" var="car" id="cars"  
    paginator="true" rows="10"  
    paginatorTemplate="{PreviousPageLink} {CurrentPageReport} {NextPageLink} {RowsPerPageDropdown}"  
    rowsPerPageTemplate="10,15" type="none">  
                <p:column>
        <f:facet name="header">  
            Notificaciones  
        </f:facet>  
                <p:commandButton icon="ui-icon-search" update=":form:carDetail"  oncomplete="carDialog.show()" title="View Detail">  
            <f:setPropertyActionListener value="#{car}" target="#{tableBean.selectedCar}" />  
                </p:commandButton>  

        <h:outputText value="#{car.manufacturer}, #{car.year}" style="margin-left:10px" />  
        <br /> 
                </p:column>
</p:dataList>  

答案 1 :(得分:0)

答案是

<p:column></p:column>中放置commandlink或commandbutton解决了我的问题。