PrimeFaces通过对话更新数据表的单行 [英] PrimeFaces update single row of datatable from dialogue

查看:72
本文介绍了PrimeFaces通过对话更新数据表的单行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个要求,我要在数据表中使用rowExpension. 这将打开另一个数据表(子表). 在子表下面,我有一个编辑按钮. 单击编辑"后,它会打开模型对话框,而单击保存"后,它会关闭对话框,但是我找不到找到更新该特定子表的方法.

I have a requirement where I am using rowExpension inside a datatable. which opens another datatable(sub table). Below sub table I have one edit button. upon clicking edit it opens model dialogue and once I click save it closes the dialogue but I am not able to find a way to update that particular sub table.

以下是子表&的代码段对话.有人可以建议我一种方法来更新单击了编辑按钮的特定子表.

Below is the code snippet of subtable & dialogue. Can anybody suggest me a way to update the particular subtable for which the edit button is clicked.

<p:rowExpansion id="partyRows">
                                <p:dataTable 
                                    var="party" 
                                    value="#{pocAccountBean.parties}" 
                                    rows="20"
                                    id="test"
                                    widgetVar="partyTable"
                                    resizableColumns="true" 
                                    emptyMessage="No associated parties found." 
                                    rowIndexVar="idx"
                                    styleClass="testClass_#{account.accountNbr}">

                                    <p:column headerText="Party Name" sortBy="#{party.partyKey}">
                                        <h:outputText value="#{party.partyKey}" />
                                    </p:column>

                                    <p:column headerText="Party Type" sortBy="#{party.partyType}">
                                        <h:outputText value="#{party.partyType}" />
                                    </p:column>

                                    <p:column headerText="Agent Code" sortBy="#{party.agentCode}">
                                        <h:outputText value="#{party.agentCode}"/>
                                    </p:column>

                                    <p:column headerText="Party Status" sortBy="#{party.partyStatus}">
                                        <h:outputText value="#{party.partyStatus}" />
                                    </p:column>

                                    <p:column headerText="Education Level" sortBy="#{party.educationLevel}">
                                        <h:outputText value="#{party.educationLevel}" />
                                    </p:column>

                                    <p:column headerText="Current Date" sortBy="#{party.currentDate}">
                                        <h:outputText value="#{party.currentDate}" />
                                    </p:column>

                            </p:dataTable>

                            <h:panelGrid columns="1" cellpadding="5" border="0">
                                 <p:commandButton value="Edit" type="button" onclick="PF('dlg2').show();"/>
                            </h:panelGrid>

                            <p:dialog header="Terms" widgetVar="dlg2" modal="true" height="400" width="800" id="d1" dynamic="true">
                                <h:inputText value="#{pocAccountBean.agentCode}" />
                                <p:commandButton action="#{pocAccountBean.setAgentCodeInParties()}" value="Save" onclick="PF('dlg2').hide();" update="@(.testClass_#{account.accountNbr})"></p:commandButton>
                            </p:dialog>

                        </p:rowExpansion>

推荐答案

RequestContext.getCurrentInstance().update("form:something:" + index + "something");

这对我有用. 更新"属性不带有运行时表达式值.

This is what worked for me. "update" attribute does not take run time expression value.

这篇关于PrimeFaces通过对话更新数据表的单行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆