This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JSF and the fly likes using h:selectManyCheckbox inside h:dataTable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "using h:selectManyCheckbox inside h:dataTable" Watch "using h:selectManyCheckbox inside h:dataTable" New topic
Author

using h:selectManyCheckbox inside h:dataTable

Marcos Maia
Ranch Hand

Joined: Jan 06, 2001
Posts: 977
Hi,

I�m having problems trying to render a selectManyCheckbox from inside dataTable.
After a db query I have a Collection of objects wich I render using dataTable, as follows:


this works as expected... but now I need to put some checkBoxes, one for each entry, so the user can choose some of them to delete or one for update for example.
With this requirenment in mind I�ve been trying to render a selectManyCheckbos given to each one the pk value from the list... it�s not working...

follows the code I�m trying to use:


any help will be appreciated.... tx in advance...
[ June 08, 2005: Message edited by: Marcos Maia ]
Henrique Sousa
Ranch Hand

Joined: Apr 29, 2004
Posts: 92
Hi Marcos,

I was trying to do that same thing a few weeks ago. With the help of some old topics, ranchers and Google, I found out that selectManyCheckbox is not such a good choice. From what I see, you want to select some 'linhaSistema' objects, right? The approach that worked for me was to add a selected (boolean) property to 'linhaSistema' and use selectBooleanCheckbox. Then you iterate over the collection again to check which objects were selected when the page is submited. Regards,


Henrique Sousa<br />SCJP 1.4<br /> <br />All men die, not all men really live - Braveheart, 1995
ram gaurav
Ranch Hand

Joined: Mar 29, 2006
Posts: 208
Hi

Its right to say that we can use <h:selectBooleanCheckbox />
But i am having the problem that how to generate dynamic ids for every checkbox, bacause it should be there so that we can easily differentiate that which checkbox is selected.

Thanks
Gaurav
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
About checkboxes in datatables, here is a useful reference: Using datatablesSelect multiple rows.
Joe Jose
Ranch Hand

Joined: Jan 14, 2004
Posts: 125
Bauke's solution worked for me. I used h:selectManyCheckbox.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: using h:selectManyCheckbox inside h:dataTable
 
Similar Threads
Problem with h:selectManyCheckbox
Centering a checkbox in a h:dataTable column
HtmlDataTable and "duplicate ID"
Scrolling problem with JSF
Formatting problem.