This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes JBoss/WildFly and the fly likes Seam ajax rerender rich:dataTable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "Seam ajax rerender rich:dataTable" Watch "Seam ajax rerender rich:dataTable" New topic
Author

Seam ajax rerender rich:dataTable

Ashok C. Mohan
Ranch Hand

Joined: Dec 03, 2003
Posts: 75
I have a rich:dataTable which has different columns inside. One of the column is a link when clicked changes an attribute of another column in the same table(it changes the value in the database by invoking a method in the Home class). After the click I want to rerender only the table(with the new data). I tried different methods, but I was not satisfied with any of them.

I tried using s:link as well as h:commandLink with a4j:support, the table is correctly rerendered but this causes the entire page to reload. I also tried a4j:commandLink to rerender only the table, but this does not update the view. Am I missing something here? Is it possible to rerender the same table in which the link is a column? Does it have anything to do with the fact that the click of the link triggers a call to the Home class and the table is prepared using a factory in the List class? I noticed that after the database is updated the factory method is not called anymore. I even tried clearing the datamodel directly in the eventContext.


SCJP 1.4
Do not dwell in the past, do not dream of the future, concentrate the mind on the present moment.
Jacob Orshalick
Author
Ranch Hand

Joined: Mar 30, 2009
Posts: 32
Yes, you can definitely do this with richfaces through the reRender attribute. If you are using a4j:commandLink specify the id of the data table in the reRender attribute. Also make sure that the action you are invoking from the a4j:commandLink returns void as you are returning to the same page.


Seam Framework: Experience the Evolution of Java EE | [url]http://solutionsfit.com[/url]
Ashok C. Mohan
Ranch Hand

Joined: Dec 03, 2003
Posts: 75
It works only if I specify the navigation in pages.xml. But this triggers a complete reload of the page. If I remove the navigation from the pages.xml, the page does not reload anymore, but so does the data table . The database is updated and if I refresh the page with an F5, the new values are shown.
My main problem is that I show both the list and the create/edit on the same page (like portlets). So I dont want the edit form to reload when I change something in the list. I have done the same for the edit button in the list. When the user clicks the edit button, i populate the data in the edit form by rerendering only the edit form. But when I try to rerender the data table from within a column in the datatable it does not work. I tried with a hardcoded row outside the datatable and everything works fine. It just does not rerender if invoked from inside.
Jacob Orshalick
Author
Ranch Hand

Joined: Mar 30, 2009
Posts: 32
Odd... I suppose you could try surrounding the data table with an a4j: outputPanel and give it a unique id. You could then specify the id of the outputPanel in the reRender attribute of the a4j:commandLink. This would at least give you an idea of whether the data table is the culprit or if there is some other issue going on in your form.
 
Don't get me started about those stupid light bulbs.
 
subject: Seam ajax rerender rich:dataTable