Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Problem with datatable update

 
Demarcus Smith
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all, I'm pretty new to JSF, but here's my question:

I have a datatable in which I have a column where each row contains a selectOneMenu. So, the initial value of each menu I take from the database. When the user selects a new value, i want that row to update to take on the new value. I have an a4j:support tag with event="onChange", but when user selects a row, every row in the datatable takes the value they selected for that one row! Do I need to bind my datatable to my backing bean somehow? Here's some code:



For example, if i have a column where the roles for each row are : employee,manager,employee. If the user changes the 3rd row to a developer, then when the I debug the bean.updateRoles method, the roles have been submitted as a developer for all 3 rows, instead of just the 3rd one! Any ideas? I don't have any bindings...
 
Demarcus Smith
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does anyone have any idea on this? Do you need more code?
 
Kavita Tipnis
Ranch Hand
Posts: 177
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, you will have to bind your datatable , then in your action event listener, get the current row data and change it.
Do not forget to reRender your table.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!