-
1. Re: Using checkbox in datatable
norman Mar 5, 2008 3:21 PM (in response to dreidel18.dreidel18.yahoo.com)Try making it a property and using something like myAction.checkBox.
-
2. Re: Using checkbox in datatable
dreidel18.dreidel18.yahoo.com Mar 6, 2008 3:05 AM (in response to dreidel18.dreidel18.yahoo.com)I've now tried making it a property but I still cant get the values for my Map. Could it be my annotations and scope?
-
3. Re: Using checkbox in datatable
nickarls Mar 6, 2008 9:26 AM (in response to dreidel18.dreidel18.yahoo.com)I'm not sure the _list.id resolves correctly as the list index.
Can't you e.g. decorate your entity with a
selected
boolean which you then connect the checkbox to? Then you can iterate through the list and see wich have been set... -
4. Re: Using checkbox in datatable
mars1412 Mar 6, 2008 12:07 PM (in response to dreidel18.dreidel18.yahoo.com)shouldn't it read:
value="#{myList.chkbox[_list.id]}"
-
5. Re: Using checkbox in datatable
nickarls Mar 6, 2008 12:26 PM (in response to dreidel18.dreidel18.yahoo.com)chkbox was outjected but I'm not sure it changes that much in this case...
-
6. Re: Using checkbox in datatable
nickarls Mar 6, 2008 12:27 PM (in response to dreidel18.dreidel18.yahoo.com)Hmmm, but it isn't injected back(?)
-
7. Re: Using checkbox in datatable
mikedougherty.miked.doughertytech.com Mar 7, 2008 10:42 PM (in response to dreidel18.dreidel18.yahoo.com)
Nicklas Karlsson wrote on Mar 06, 2008 09:26 AM:
I'm not sure the _list.id resolves correctly as the list index.
Can't you e.g. decorate your entity with aselected
boolean which you then connect the checkbox to? Then you can iterate through the list and see wich have been set...Can you expand on this a little? I'd like to see if what you are suggesting can solve my current challenge with checkboxes and datatables.
Thanks,
Mike -
8. Re: Using checkbox in datatable
nickarls Mar 7, 2008 11:20 PM (in response to dreidel18.dreidel18.yahoo.com)There are probably better/cleaner ways to do it but I have used a sort of
public class SelectedEntity { private boolean selected = false; private Entity entity; public SelectedEntity(Entity entity) { this.entity = entity; } ... setters / getters }
and then I return a List<SelectedEntity> to the datatable and bind the checkbox to var.selected and data to var.entity.entityproperty.
then when I perform an action I loop
for (SelectedEntity selectedEntity : list) { if (selectedEntity.isSelected) { doSomethingWith(selectedEntity.entity); } }
-
9. Re: Using checkbox in datatable
nickarls Mar 7, 2008 11:25 PM (in response to dreidel18.dreidel18.yahoo.com)Some more discussion on the topic