嗨!
我有以下问题。
正如我在标题中所写,我有一个具有单元内编辑行为的数据表!
现在,如果我为 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"> <form id="form" name="form" method="post" action="/rainstar2-webapp/wirkungsgradeEdit.xhtml" enctype="application/x-www-form-urlencoded"> <input type="hidden" name="form" value="form" /> <div id="panelView" class="ui-panel ui-widget ui-widget-content ui-corner-all"><div id="panelView_content" class="ui-panel-content ui-widget-content"><tr data-ri="0" class="ui-widget-content ui-datatable-even" role="row"><td role="gridcell" class="ui-editable-column"><div class="ui-dt-c"><span id="ea:0:j_idt56" class="ui-cell-editor"><span class="ui-cell-editor-output">1</span><span class="ui-cell-editor-input"><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" /><script id="ea:0:j_idt58_s" type="text/javascript">PrimeFaces.cw('InputText','widget_ea_0_j_idt58',{id:'ea:0:j_idt58'});</script></span></span></div></td><td role="gridcell" class="ui-editable-column"><div class="ui-dt-c"><span id="ea:0:j_idt60" class="ui-cell-editor"><span class="ui-cell-editor-output">65Ti</span><span class="ui-cell-editor-input"><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" /><script id="ea:0:j_idt62_s" type="text/javascript">PrimeFaces.cw('InputText','widget_ea_0_j_idt62',{id:'ea:0:j_idt62'});</script></span></span></div></td><td role="gridcell" class="ui-editable-column"><div class="ui-dt-c"><span id="ea:0:j_idt64" class="ui-cell-editor"><span class="ui-cell-editor-output">0.195286</span><span class="ui-cell-editor-input"><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" /><script id="ea:0:j_idt66_s" type="text/javascript">PrimeFaces.cw('InputText','widget_ea_0_j_idt66',{id:'ea:0:j_idt66'});</script></span></span></div></td><td role="gridcell" class="ui-editable-column"><div class="ui-dt-c"><span id="ea:0:j_idt68" class="ui-cell-editor"><span class="ui-cell-editor-output">-2.95382</span><span class="ui-cell-editor-input"><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" /><script id="ea:0:j_idt70_s" type="text/javascript">PrimeFaces.cw('InputText','widget_ea_0_j_idt70',{id:'ea:0:j_idt70'});</script></span></span></div></td><td role="gridcell" class="ui-editable-column"><div class="ui-dt-c"><span id="ea:0:j_idt72" class="ui-cell-editor"><span class="ui-cell-editor-output">16.3314</span><span class="ui-cell-editor-input"><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" /><script id="ea:0:j_idt74_s" type="text/javascript">PrimeFaces.cw('InputText','widget_ea_0_j_idt74',{id:'ea:0:j_idt74'});</script></span></span></div></td><td role="gridcell" class="ui-editable-column"><div class="ui-dt-c"><span id="ea:0:j_idt76" class="ui-cell-editor"><span class="ui-cell-editor-output">1.50794</span><span class="ui-cell-editor-input"><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" /><script id="ea:0:j_idt78_s" type="text/javascript">PrimeFaces.cw('InputText','widget_ea_0_j_idt78',{id:'ea:0:j_idt78'});</script></span></span></div></td><td role="gridcell"><div class="ui-dt-c"><span id="ea:0:j_idt80" class="ui-row-editor"><span class="ui-icon ui-icon-pencil"></span><span class="ui-icon ui-icon-check" style="display:none"></span><span class="ui-icon ui-icon-close" style="display:none"></span></span><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"><span class="ui-button-icon-left ui-icon ui-icon-close"></span><span class="ui-button-text">ui-button</span></button><script id="ea:0:j_idt81_s" type="text/javascript">PrimeFaces.cw('CommandButton','widget_ea_0_j_idt81',{id:'ea:0:j_idt81'});</script></div></td></tr></div></div><script id="panelView_s" type="text/javascript">PrimeFaces.cw('Panel','widget_panelView',{id:'panelView'});</script> <div class="button-footer"><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"><span class="ui-button-icon-left ui-icon ui-icon-plus"></span><span class="ui-button-text">Neuer Eintrag</span></button><script id="j_idt83_s" type="text/javascript">PrimeFaces.cw('CommandButton','widget_j_idt83',{id:'j_idt83'});</script> </div><?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"><body><div id="passwdDialog" class="ui-dialog ui-widget ui-widget-content ui-overlay-hidden ui-corner-all ui-shadow"><div class="ui-dialog-titlebar ui-widget-header ui-helper-clearfix ui-corner-top"><span class="ui-dialog-title">???header_password_input???</span></div><div class="ui-dialog-content ui-widget-content">???verwaltung_password_eingabe_text???<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"><span class="ui-button-text">ok</span></button><script id="j_idt89_s" type="text/javascript">PrimeFaces.cw('CommandButton','widget_j_idt89',{id:'j_idt89'});</script><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"><span class="ui-button-text">abbrechen</span></button><script id="j_idt90_s" type="text/javascript">PrimeFaces.cw('CommandButton','widget_j_idt90',{id:'j_idt90'});</script></div></div><script id="passwdDialog_s" type="text/javascript">$(function() {PrimeFaces.cw('Dialog','widget_passwdDialog',{id:'passwdDialog',draggable:false,resizable:false,modal:true});});</script></body> </html> </form></update>
<update id="javax.faces.ViewState">3885032117216220483:-4426574710948878891</update>
</changes>
</partial-response>
亲切的问候马蒂亚斯