This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes JSF and the fly likes selectOneMenu and dataTable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "selectOneMenu and dataTable" Watch "selectOneMenu and dataTable" New topic
Author

selectOneMenu and dataTable

Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

I've got a selectOneMenu that contains a list of categories. There is an OK button that when pressed, submits the form which updates a parentCatId property to whatever is selected in the selectOneMenu.

I also have a dataTable that contains a list of subCategories for the selected category.

Problem: When the page is loaded and the list is populated with default subCategories, I click on one of the subCategories in the dataTable (commandLink) and display the details of said subCategory on the right side of the page. This works until....

I choose a different parentCategory from the selectOneMenu. The dataTable is populated with the new subCategories but when I click on a subCategory I still get the old details. There is a UIData property bound to the dataTable. I think that possibly, when I click the OK button, this model is not getting updated with the new list of subCategories.

Has anyone experienced this and/or know of a way to solve this?

Thanks.


GenRocket - Experts at Building Test Data
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

I added preserveDataModel="true" to my dataTable and it appears to be working, for now.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: selectOneMenu and dataTable
 
Similar Threads
create object
object design
I need help with ajaxSingle, reRender and immediate.
DataTable with DataScroller issue
Problem with initializing managed-property parameter