Primefaces Inline DataTable删除功能 [英] Primefaces Inline DataTable Delete functionality

查看:225
本文介绍了Primefaces Inline DataTable删除功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是内联编辑datatable,它包含了RowEditor和CommandButton,用于删除记录。我的问题是当我从数据库中删除任何记录时,行被成功删除,删除的记录显示何时我点击编辑按钮编辑下一个记录。这个编辑问题继续所有的记录。它显示h中的当前值:outputText和h:inputText中的旧值,当我们点击编辑按钮时。
有人可以帮我吗?
谢谢大家。

I'm using primefaces inline editing datatable.which consists of primefaces RowEditor and a CommandButton to delete the record.My Problem is when i deleted any record from the the database,the row is successfully deleted and the deleted record is showing when i click on the edit button for editing the next record.This edit problem continues with all the records .It is showing the present value in h:outputText and the old value in h:inputText which comes when we click on edit button. Could anyone help me on this ? Thankyou all.

推荐答案

< p:dataTable> 组件,所以我不会搜索所有的。

There are a lot of Primefaces bugs logged on the <p:dataTable> component, so I am not going to search through all of them.

然而,我知道有一个开放的错误,从原型2.2.1说明< p:dataTable> 行内的组件将无法正确更新(刷新)dataTable中的相应值。此问题可能在Primefaces 3.0中被修复。如果您有兴趣,可以搜索已知错误此处

I do know however that there is an open bug as of Primefaces 2.2.1 stating that components within a row of a <p:dataTable> will not correctly update (refresh) the appropriate values within the dataTable. This problem MAY be fixed in Primefaces 3.0. If you are interested you can search the known bugs here.

幸运的是,我已经找出了一个解决办法。您需要从< p:dataTable> 的组件OUTSIDE执行异步操作,并确保组件在其更新属性。

Fortunately I have figured out a workaround for this. You need to perform an asynchronous operation from a component OUTSIDE of the <p:dataTable> and make sure that component sets the id of the dataTable in its update attribute.

<h:form id="form1">
  <p:commandButton widgetVar="updateButton" update="form1:table1" ... />
  <p:dataTable id="table1" ...>
    <p:column ...>
      <p:commandButton id="deleteButton" action="#{managedBean.doDelete}" oncomplete="javascriptFunction();" ... />
    </p:column>
  </p:dataTable>
</h:form>

在javascript:

And in a javascript:

function javascriptFunction() {
  updateButton.jq.click();
}

这篇关于Primefaces Inline DataTable删除功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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