-1

ap:dialog のデータテーブルの行を選択して設定された (既に解決済みの) Bean に格納されたデータで p:inputtext を更新する例を見つけるのを手伝ってください。同じ方法でoutputtextの更新に成功しました。

私は(学習中)netbeans 7.2 primefaces 3.2、glassfish 3.1を使用しています

助けてくれてありがとう

rs_ncs

4

3 に答える 3

0

データテーブルから行を選択してコンポーネントを更新する場合は、イベントをリッスンしている のupdate属性を使用できます。このようなもの:<p:ajax>rowselect

<p:ajax event="rowSelect" update=":xx:xx" />
于 2012-12-11T10:35:00.920 に答える
0

BalusC によって提案されたように、コードは動作する<p:ajax event="rowSelect" update=":xx:xx" />はずです....

以下は、inputtext と outputtext の両方を更新する例です。

<h:form>
    <p:dataTable id="usertable" var="user" value="#{userManageBean.userList}"
        rowKey="#{user.U_ID}" selection="#{userManageBean.selectedUser}"
        selectionMode="single" paginator="true" rows="18" >



        <p:ajax event="rowSelect" update=":useredit:edituser" />
        <p:ajax event="rowSelect" update=":viewuser:displayuser" />



        <p:column headerText="User Name">
            <h:outputText value="#{user.username}" />
        </p:column>

        <p:column headerText="FName">
            <h:outputText value="#{user.firstname}" />
        </p:column>

        <p:column headerText="LName">
            <h:outputText value="#{user.lastname}" />
        </p:column>



    </p:dataTable>
</h:form>

<p:dialog id="userview" header="View User" widgetVar="dlg2" >

    <h:form id="viewuser">
        <h:panelGrid id="displayuser" columns="2" cellpadding="4">
            <h:outputText value="User Name:" />
            <h:outputText value="#{userManageBean.selectedUser.username}" />

            <h:outputText value="First Name" />
            <h:outputText value="#{userManageBean.selectedUser.firstname}" />

            <h:outputText value="Last Name:" />
            <h:outputText value="#{userManageBean.selectedUser.lastname}" />

        </h:panelGrid>
    </h:form>

</p:dialog>

<p:dialog id="user_edit" header="Edit User" widgetVar="dlgedit" >

    <h:form id="useredit">

        <h:panelGrid id="edituser" columns="2" cellpadding="4">

            <h:outputText value="First Name" />
            <h:inputText value="#{userManageBean.selectedUser.firstname}" />


            <h:outputText value="Last Name" />
            <h:inputText value="#{userManageBean.selectedUser.lastname}" />


            <p:commandButton id="updateUser" value="Add" action="#{someaction}"
                ajax="false" />


        </h:panelGrid>
    </h:form>
</p:dialog>
于 2013-01-04T12:54:55.650 に答える
0

primefacesショーケースユーザー ガイドを参照すると、必要なものがすべて見つかります。詳しくは、データテーブル コンポーネントの rowSelect イベントを検索してください。頑張ってください=)

于 2012-12-11T10:14:30.810 に答える