[jboss-user] [JBoss Seam] - Re: 2 DataModel questions
bfo81
do-not-reply at jboss.com
Thu Aug 31 07:23:18 EDT 2006
I've already seen an example with a nested table. But the problem is that you cannot put that nested table in a new ROW, since rows are "connected" only to the entities you iterate. But you can put a "sub-table" in a COLUMN.
2) I had an idea about your second question. You might add a property delete (with default value false) to your listed entities and connect it to a SelectBooleanCheckbox. And at the bottom of the table you have a button "Delete selected items".
<h:dataTable var="item" value="#{listOfItems}" ...
|
| ...<h:column><h:selectBooleanCheckbox value="#{item.delete}" /></h:column>...
|
| </h:dataTable>
|
| <h:commandButton value="Delete selected items" action="#{actionBean.deleteSelected}" />
@Name("actionBean")
| ...
| public String deleteSelected() {
| for (Item item: listOfItems)
| if (item.isDelete())
| em.remove(item);
| return null;
| }
That's the plain idea. I think it should work, but maybe you need to regard things like e.g. reloading the list after deletion. And when having problems with detached entities use em.remove(em.find(Item.class, item.getId())); to work on managed entities.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3968600#3968600
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3968600
More information about the jboss-user
mailing list