This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes JSF and the fly likes JSF datatable rendering problem with ajax Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "JSF datatable rendering problem with ajax" Watch "JSF datatable rendering problem with ajax" New topic
Author

JSF datatable rendering problem with ajax

Denis Sysoev
Greenhorn

Joined: Aug 29, 2012
Posts: 6
Hello,
I have datatable with "delete" button in each row. When clicked, method should remove object from List and database, and after, I want to re-render datatable. After clicking "delete" all what I have expected working fine, except of re-rendering datatable. To see changes I need explicitly refresh page, so without Ajax its working perfectly.
JSF Table:

Bean method:

Im find a lot in Google same problems, but still no luck with fixing this, please point me whats wrong. Thanks in advance.
Volodymyr Levytskyi
Ranch Hand

Joined: Mar 29, 2012
Posts: 505
    
    1

Hello!

You may find interesting to look at my post about f:ajax at http://www.coderanch.com/t/594176/JSF/java/dynamic-div-reset#2708812
Try this f:ajax
<f:ajax execute='transactions' event='click' render="transactions"/>


True person is moral, false is right!
Denis Sysoev
Greenhorn

Joined: Aug 29, 2012
Posts: 6
Volodymyr Levytskyi wrote:Hello!

You may find interesting to look at my post about f:ajax at http://www.coderanch.com/t/594176/JSF/java/dynamic-div-reset#2708812

Thanks but I have read this post before I post this one.
Volodymyr Levytskyi wrote:
Try this f:ajax
<f:ajax execute='transactions' event='click' render="transactions"/>

The same reaction. With event='click', its even didn't call my method.
Volodymyr Levytskyi
Ranch Hand

Joined: Mar 29, 2012
Posts: 505
    
    1

Hello!

Sorry, probably it is not needed to execute the whole table on event 'click' but only commandbutton
<f:ajax execute='@this' event='click' render="transactions"/>

Also h:commandButton should be inside h:form
Denis Sysoev
Greenhorn

Joined: Aug 29, 2012
Posts: 6
Volodymyr Levytskyi wrote:Hello!

Sorry, probably it is not needed to execute the whole table on event 'click' but only commandbutton
<f:ajax execute='@this' event='click' render="transactions"/>

Also h:commandButton should be inside h:form

Its not working for me, and yes it was inside form.

I have solve my problem by adding wrapper for datatable and re-render it. Something like this:

Thank You for your help
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JSF datatable rendering problem with ajax