【问题标题】:Primefaces datalist ajax-pagination dialog not updatedPrimefaces datalist ajax 分页对话框未更新
【发布时间】:2012-07-05 04:43:50
【问题描述】:

我正在尝试使用 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 方法很好。

谢谢

【问题讨论】:

    标签: dialog primefaces datalist


    【解决方案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>  
    

    【讨论】:

    • 嘿,您能否详细说明提问者的实施有什么问题?
    • @ile 你在说哪个提问者?
    • 穆达西尔的问题,你正在回答的那个。提供代码示例很棒,但如果您提供一些解释,它也会非常有用。
    • @ile 由于格式不正确,代码被隐藏。我建议对该答案进行更正。请注意,您还可以通过提及他们的用户名来通知之前的评论者,例如@ile
    • @akoskm,对不起,我以为 api 会自动通知用户在他们的帖子中使用 cmets
    【解决方案2】:

    答案是

    将命令链接或命令按钮放在&lt;p:column&gt;&lt;/p:column&gt; 中解决了我的问题。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-08-03
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多