开发者

Primefaces Inline DataTable Delete functionality

开发者 https://www.devze.com 2023-03-14 13:20 出处:网络
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

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 开发者_Go百科anyone help me on this ? Thankyou all.


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

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.

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>

And in a javascript:

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

精彩评论

暂无评论...
验证码 换一张
取 消