users@woodstock.java.net

Re: dynamically add rowgroups to table

From: Dan Labrecque <Dan.Labrecque_at_Sun.COM>
Date: Mon, 21 Jan 2008 10:39:34 -0500

Using the action expression of a button, you can easily add/remove rows
from the DataProvider. The table always obtains the DataProvider at
least twice during a request; once when decoding the previous page,
again when rendering the table. Therefore, you don't necessarily need a
component binding (i.e., a getTable() method).

You can find examples of this in the TLD docs below. See the "Example 7:
Table Actions" section of the "webuijsf:table" tag -- also check out the
Actions.java class.

    http://webdev2.sun.com/woodstock-tlddocs

Note that this code is from the live example below. Just select a row
and click on the "Delete" button to remove a row.

    http://webdev2.sun.com/example/faces/table/table.jsp

Dan

autozoom wrote:
> hello,
> I am trying to do this: whenever I click a button, I want a new rowgroup to
> be added to an existing table.
> The example that comes with woodstock components isn't really "dynamic" in
> the sense that it creates rowgroups by code, but all at the same time on the
> first table creation.
> The problem is that the getTable() method is called only the first time and
> so you cannot add rowgroups using this approach.
> Any ideas?
> thanks
>