Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

selectBooleanCheckbox inside dataTableEx  RSS feed

 
Marc Kruze
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

On a dataTableEx, one of the columns is a selectBooleanCheckbox. When the user selects the checkbox an onclick action is called where I update a rich:calendar with a date in the future (12/31/9999). If the user unselects the checkbox, the onclick action sets the date to null (clears the rich:calendar).

The problem is that the javascript action runs and updates the calendar field, but then the values are set to whatever they were before. So I added a valueChangeListener function to take care of the backing bean date property. But because this is a dataTableEx, there can be N number of checkboxes and calendar rows, and I can't get which row the user clicked the checkbox on so I can update the appropriate property on the backing bean array list, like this:



where "...get(index)..." is what I need in order to set the right data in the array list.

Please someone help!
 
Marc Kruze
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Resolved through the valueChangedEvent object:

 
Tim Holloway
Bartender
Posts: 18709
71
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To get the data row that was clicked on in an action method, use the datamodel getRowData() method.

For a value change event to get the control, use the event's "getSource()" method.

Believe it or not, JSF is designed to make stuff simple. For some reason everybody thinks they need to dive into the mud to do common tasks.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!