Skip to main content

Refresh ADF table programmatically

This is the same post to this post.

It achieve the same result of PPR. This is used when somehow PPR in the table isn't working properly. For instance, you have a transaction process on the selected row in a table. You select the row in the table, and click the button which will perform the transaction process, but somehow the table isn't refreshed to the updated state of the row (even though you setup the PPR declaratively).

But you alway could solve this programmatically.

Here I posted the snapshot of the coding snippet.

















You can call setSelectedRow(getSelectedRowStr()) inside the actionListener of the button which will perform the custom transaction.

Another scenario: if you have a called task flow to process some transaction on the table and upon return to the calling task flow, the user wants to see the transaction changes which were performed during the called task flow. The solution is you can add a method action in the calling task flow to refresh the binding iterator of the table before returning to the page having the table.



Please note the refresh method is put in the backing bean and by default has no binding at all. Since we can calling the iteratorBinding, it's required to add the proper iterator in the binding. So Create page definition for the method action and add the proper iterator.



Take a look at the icon of the method action in the calling task flow, if it already has a page definition, it will have a little icon at the right bottom.

Comments

Anonymous said…
I Suppose that the button has "partialSubmit" property set to false.
The whole table is being refreshed (with the fetching data.... message).
What about, if we want to refresh only the selected row wihtout refresing the whole table ?

Regards

Nicolas
JayJay Zheng said…
The commandToolBarButton which I use has the partialSubmit to "True" by default. Even though you set up the ppr programatically use AdfFacesContext.addPartialTrigger() it still may not work.

Since all the transaction is based on a "row", refresh the table is equivalent to refresh just the row. But you could use Row.refresh() API to refresh just the current row in the table iteratorBinding.
AjAiN said…
Hi,

i defined a refresh method in the bean now i am not able to get where should i put this method in the first taskflow(calling)?
Anonymous said…
Its very helpful for my.

Regads
Sameera