0

嗨!

我有以下问题。

正如我在标题中所写,我有一个具有单元内编辑行为的数据表!

现在,如果我为 rowEdit 事件添加一个 ajax 组件,我总是会看到这个丑陋的视图,如果我刷新站点,它就会消失。

另外:当 rowEdit 事件发生时,我还实现了一个对话框。但这没关系。因为我也试过没有对话框。

这是带有 dataTable 部分的 html 代码:

<p:dataTable var="dataRow"
                first="#{wirkungsgradeEditBean.firstRowIndex}"
                value="#{wirkungsgradeEditBean.wirkgradList}" editable="true"
                id="ea" paginator="true"
                rows="#{wirkungsgradeEditBean.rowsPerPage}"
                paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
                rowsPerPageTemplate="15,25,35">
                <p:column headerText="#{msg.table_wirkungsgrade_wirk_reihe}">
                <p:column headerText="#{msg.table_wirkungsgrade_wirk3}">
                    <p:cellEditor>
                        <f:facet name="output">
                            <h:outputText value="#{dataRow.wirk3}" />
                        </f:facet>
                        <f:facet name="input">
                            <p:inputText value="#{dataRow.wirk3}" required="true" />
                        </f:facet>
                    </p:cellEditor>
                </p:column>
                <p:column headerText="#{msg.table_wirkungsgrade_wirk4}">
                    <p:cellEditor>
                        <f:facet name="output">
                            <h:outputText value="#{dataRow.wirk4}" />
                        </f:facet>
                        <f:facet name="input">
                            <p:inputText value="#{dataRow.wirk4}" required="true" />
                        </f:facet>
                    </p:cellEditor>
                </p:column>
                <p:column headerText="#{msg.column_head_edit}">
                    <p:rowEditor />
                    <p:commandButton icon="ui-icon-close"
                        styleClass="rainstar-button-small-edit"
                        action="#{wirkungsgradeEditBean.btn_deleteEntryClick()}"
                        update=":form">
                        <f:setPropertyActionListener value="#{dataRow}"
                            target="#{wirkungsgradeEditBean.selectedWirkgrad}" />
                    </p:commandButton>
                </p:column>
                <p:ajax event="rowEdit"
                    listener="#{wirkungsgradeEditBean.btn_editEntryClick}"
                    update=":form"  />
            </p:dataTable>

这是我的意思的图片。

在此处输入图像描述

在此处输入图像描述

谢谢你!

更新(Ajax 请求返回)

标题

       HTTP/1.1 200 OK
       Server: Apache-Coyote/1.1
       X-Powered-By: JSF/2.0
       Cache-Control: no-cache
       Set-Cookie: csfcfc=7Xfn_10Xfn
       Content-Type: text/xml;charset=UTF-8
       Content-Length: 6781
       Date: Thu, 24 May 2012 07:04:43 GMT

XML

<partial-response>
   <changes>
     <update id="form"> &lt;form id="form" name="form" method="post"                   action="/rainstar2-webapp/wirkungsgradeEdit.xhtml" enctype="application/x-www-form-urlencoded"&gt; &lt;input type="hidden" name="form" value="form" /&gt; &lt;div id="panelView" class="ui-panel ui-widget ui-widget-content ui-corner-all"&gt;&lt;div id="panelView_content" class="ui-panel-content ui-widget-content"&gt;&lt;tr data-ri="0" class="ui-widget-content ui-datatable-even" role="row"&gt;&lt;td role="gridcell" class="ui-editable-column"&gt;&lt;div class="ui-dt-c"&gt;&lt;span id="ea:0:j_idt56" class="ui-cell-editor"&gt;&lt;span class="ui-cell-editor-output"&gt;1&lt;/span&gt;&lt;span class="ui-cell-editor-input"&gt;&lt;input id="ea:0:j_idt58" name="ea:0:j_idt58" type="text" value="1" class="ui-inputfield ui-inputtext ui-widget ui-state-default ui-corner-all" /&gt;&lt;script id="ea:0:j_idt58_s" type="text/javascript"&gt;PrimeFaces.cw('InputText','widget_ea_0_j_idt58',{id:'ea:0:j_idt58'});&lt;/script&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;&lt;td role="gridcell" class="ui-editable-column"&gt;&lt;div class="ui-dt-c"&gt;&lt;span id="ea:0:j_idt60" class="ui-cell-editor"&gt;&lt;span class="ui-cell-editor-output"&gt;65Ti&lt;/span&gt;&lt;span class="ui-cell-editor-input"&gt;&lt;input id="ea:0:j_idt62" name="ea:0:j_idt62" type="text" value="65Ti" class="ui-inputfield ui-inputtext ui-widget ui-state-default ui-corner-all" /&gt;&lt;script id="ea:0:j_idt62_s" type="text/javascript"&gt;PrimeFaces.cw('InputText','widget_ea_0_j_idt62',{id:'ea:0:j_idt62'});&lt;/script&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;&lt;td role="gridcell" class="ui-editable-column"&gt;&lt;div class="ui-dt-c"&gt;&lt;span id="ea:0:j_idt64" class="ui-cell-editor"&gt;&lt;span class="ui-cell-editor-output"&gt;0.195286&lt;/span&gt;&lt;span class="ui-cell-editor-input"&gt;&lt;input id="ea:0:j_idt66" name="ea:0:j_idt66" type="text" value="0.195286" class="ui-inputfield ui-inputtext ui-widget ui-state-default ui-corner-all" /&gt;&lt;script id="ea:0:j_idt66_s" type="text/javascript"&gt;PrimeFaces.cw('InputText','widget_ea_0_j_idt66',{id:'ea:0:j_idt66'});&lt;/script&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;&lt;td role="gridcell" class="ui-editable-column"&gt;&lt;div class="ui-dt-c"&gt;&lt;span id="ea:0:j_idt68" class="ui-cell-editor"&gt;&lt;span class="ui-cell-editor-output"&gt;-2.95382&lt;/span&gt;&lt;span class="ui-cell-editor-input"&gt;&lt;input id="ea:0:j_idt70" name="ea:0:j_idt70" type="text" value="-2.95382" class="ui-inputfield ui-inputtext ui-widget ui-state-default ui-corner-all" /&gt;&lt;script id="ea:0:j_idt70_s" type="text/javascript"&gt;PrimeFaces.cw('InputText','widget_ea_0_j_idt70',{id:'ea:0:j_idt70'});&lt;/script&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;&lt;td role="gridcell" class="ui-editable-column"&gt;&lt;div class="ui-dt-c"&gt;&lt;span id="ea:0:j_idt72" class="ui-cell-editor"&gt;&lt;span class="ui-cell-editor-output"&gt;16.3314&lt;/span&gt;&lt;span class="ui-cell-editor-input"&gt;&lt;input id="ea:0:j_idt74" name="ea:0:j_idt74" type="text" value="16.3314" class="ui-inputfield ui-inputtext ui-widget ui-state-default ui-corner-all" /&gt;&lt;script id="ea:0:j_idt74_s" type="text/javascript"&gt;PrimeFaces.cw('InputText','widget_ea_0_j_idt74',{id:'ea:0:j_idt74'});&lt;/script&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;&lt;td role="gridcell" class="ui-editable-column"&gt;&lt;div class="ui-dt-c"&gt;&lt;span id="ea:0:j_idt76" class="ui-cell-editor"&gt;&lt;span class="ui-cell-editor-output"&gt;1.50794&lt;/span&gt;&lt;span class="ui-cell-editor-input"&gt;&lt;input id="ea:0:j_idt78" name="ea:0:j_idt78" type="text" value="1.50794" class="ui-inputfield ui-inputtext ui-widget ui-state-default ui-corner-all" /&gt;&lt;script id="ea:0:j_idt78_s" type="text/javascript"&gt;PrimeFaces.cw('InputText','widget_ea_0_j_idt78',{id:'ea:0:j_idt78'});&lt;/script&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;&lt;td role="gridcell"&gt;&lt;div class="ui-dt-c"&gt;&lt;span id="ea:0:j_idt80" class="ui-row-editor"&gt;&lt;span class="ui-icon ui-icon-pencil"&gt;&lt;/span&gt;&lt;span class="ui-icon ui-icon-check" style="display:none"&gt;&lt;/span&gt;&lt;span class="ui-icon ui-icon-close" style="display:none"&gt;&lt;/span&gt;&lt;/span&gt;&lt;button id="ea:0:j_idt81" name="ea:0:j_idt81" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-icon-only rainstar-button-small-edit" onclick="PrimeFaces.ab({formId:'form',source:'ea:0:j_idt81',process:'@all',update:'form'});return false;" type="submit"&gt;&lt;span class="ui-button-icon-left ui-icon ui-icon-close"&gt;&lt;/span&gt;&lt;span class="ui-button-text"&gt;ui-button&lt;/span&gt;&lt;/button&gt;&lt;script id="ea:0:j_idt81_s" type="text/javascript"&gt;PrimeFaces.cw('CommandButton','widget_ea_0_j_idt81',{id:'ea:0:j_idt81'});&lt;/script&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/div&gt;&lt;/div&gt;&lt;script id="panelView_s" type="text/javascript"&gt;PrimeFaces.cw('Panel','widget_panelView',{id:'panelView'});&lt;/script&gt; &lt;div class="button-footer"&gt;&lt;button id="j_idt83" name="j_idt83" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-icon-left button-header" onclick="PrimeFaces.ab({formId:'form',source:'j_idt83',process:'@all',update:'form'});return false;" type="submit"&gt;&lt;span class="ui-button-icon-left ui-icon ui-icon-plus"&gt;&lt;/span&gt;&lt;span class="ui-button-text"&gt;Neuer Eintrag&lt;/span&gt;&lt;/button&gt;&lt;script id="j_idt83_s" type="text/javascript"&gt;PrimeFaces.cw('CommandButton','widget_j_idt83',{id:'j_idt83'});&lt;/script&gt; &lt;/div&gt;&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;&lt;body&gt;&lt;div id="passwdDialog" class="ui-dialog ui-widget ui-widget-content ui-overlay-hidden ui-corner-all ui-shadow"&gt;&lt;div class="ui-dialog-titlebar ui-widget-header ui-helper-clearfix ui-corner-top"&gt;&lt;span class="ui-dialog-title"&gt;???header_password_input???&lt;/span&gt;&lt;/div&gt;&lt;div class="ui-dialog-content ui-widget-content"&gt;???verwaltung_password_eingabe_text???&lt;button id="j_idt89" name="j_idt89" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" onclick="PrimeFaces.ab({formId:'form',source:'j_idt89',process:'@all',update:'passwdDialog',oncomplete:function(xhr, status, args){window.location.reload(true);;}});return false;" type="submit"&gt;&lt;span class="ui-button-text"&gt;ok&lt;/span&gt;&lt;/button&gt;&lt;script id="j_idt89_s" type="text/javascript"&gt;PrimeFaces.cw('CommandButton','widget_j_idt89',{id:'j_idt89'});&lt;/script&gt;&lt;button id="j_idt90" name="j_idt90" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" onclick="PrimeFaces.ab({formId:'form',source:'j_idt90',process:'@all',update:'passwdDialog'});return false;" type="submit"&gt;&lt;span class="ui-button-text"&gt;abbrechen&lt;/span&gt;&lt;/button&gt;&lt;script id="j_idt90_s" type="text/javascript"&gt;PrimeFaces.cw('CommandButton','widget_j_idt90',{id:'j_idt90'});&lt;/script&gt;&lt;/div&gt;&lt;/div&gt;&lt;script id="passwdDialog_s" type="text/javascript"&gt;$(function() {PrimeFaces.cw('Dialog','widget_passwdDialog',{id:'passwdDialog',draggable:false,resizable:false,modal:true});});&lt;/script&gt;&lt;/body&gt; &lt;/html&gt; &lt;/form&gt;</update>
     <update id="javax.faces.ViewState">3885032117216220483:-4426574710948878891</update>
      </changes>
       </partial-response>

亲切的问候马蒂亚斯

4

1 回答 1

3

改变你update=":form"update=":form:ea"p:ajax

于 2012-06-04T03:53:13.230 回答