Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Seam ajax rerender rich:dataTable

 
Ashok C. Mohan
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Jacob Orshalick
Author
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ashok C. Mohan
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic