datatable does not support changing columns, something on a todo list
to fix in 1.5. for now you can just recreate the datatable itself.

-igor

On Thu, Apr 23, 2009 at 8:35 AM, Alfredo Aleandri
<[email protected]> wrote:
> Hi,
> I'm a wicket beginner.
> I'm trying to shuffle the columns of a datatable using an AjaxFallbackLink,
> this is my code (only relevant part):
>
> my WebPage content:
>
>   private AjaxFallbackDefaultDataTable usersTable;
>   private List<IColumn<?>> userColumns = new ArrayList<IColumn<?>>();
>   private UserProvider userProvider = new UserProvider();
>
>   public QueryPage() {
>             userColumns.add(new PropertyColumn(new Model<String>("First
> Name"), "FIRSTNAME", "firstName"));
>       userColumns.add(new PropertyColumn(new Model<String>("Last Name"),
> "LASTNAME", "lastName"));
>       usersTable = new AjaxFallbackDefaultDataTable("users_table",
> userColumns, userProvider, 20);
>       usersTable.setOutputMarkupId(true);
>       add(usersTable);
>             add(new AjaxFallbackLink("users_shuffle") {
>           @Override
>           public void onClick(AjaxRequestTarget target) {
>               Collections.shuffle(userColumns);
>               usersTable = new AjaxFallbackDefaultDataTable("users_table",
> userColumns, userProvider, 20);
>               if (target != null) {
>                   target.addComponent(usersTable);
>               }
>           }
>       });
>
>   }
>
> my html page content:
>
>   <a wicket:id="users_shuffle" href="#">Shuffle!</a>
>   <table wicket:id="users_table">[table]</table>
>
>
> When I click the ajax link the "onClick" is executed, the userColumns list
> is shuffled but the page rendering is always the same as defined in the
> constructor of the WebPage.
> I've tryied also using a standard Link (no ajax) getting the same result.
> I'm using Wicket 1.4rc2.
>
> Thank you
>
> Alfredo
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to