How to refresh a row in a dataTable?

UI Components for JSF
Post Reply
dxxvi
Posts: 10
Joined: 22 Oct 2009, 12:42

01 Nov 2010, 21:08

When I looked at the incell editing, I thought it would show some way to refresh a row in a dataTable, but then I realized that the <p:rowEditor>, <p:cellEditor> are very specific for the row editing problem. I think if there is a way to refresh a row in a dataTable, then we can combine that way and the Basic Row Selection example to solve the row editing problem.

Could somebody give me an advice for my situation? I'd like to display a List<FileInfo> like this:
Image
When we click on the button in the Action column, we send that row to the server, modify it (modify the Status field) and refresh that row.
Image
This is the bean code:
Image
I put a break point inside the testX method and canbe sure that the fi variable is not null.
From the JSF xhtml code, you can notice that I have "id='status'" for the cell in the Status column which will be updated by the <p:commandButton> in the Actions column. However this doesn't work as I expected. Firebug shows that there's no id of "xxx:status" for that <td>. You will also notice in firebug that the button, which is the <p:commandButton>, will update the "j_idt11:j_idt12:0:status" element, but the <td> right in front of this button doesn't have such id.

Thank you for any advice.
Image

Another problem I encountered is that the <f:setPropertyActionListener> inside the <p:commandButton> didn't work in my case. I mean this code doesn't work:

Code: Select all

<p:commandButton update="status" actionListener="#{index.checkStatus}">
  <f:setPropertyActionListener value="#{fileInfo}" target="#{index.currentFileInfo}"/>
</p:commandButton>
the currentFileInfo variable is null!?! Don't know why.

User avatar
tefron
Posts: 94
Joined: 15 Sep 2010, 23:54
Location: Canada
Contact:

02 Nov 2010, 17:55

did you try to add an output text to the status column and bind it to the file.status?
PrimeFaces: primefaces-8.0
Mojara2.3
Netbeans8.2
wildfly-17.0.1.Final

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 16 guests