Hi,

> I have a DefaultDataTable with several amount colums. I need to display
> a "Totals" row at the bottom of the table to show the column totals.

> I have searched the forum, and only found suggestions to use
> addBottomToolbar.

correct..

> However, I don't know how to do this? Looking at Wicket's HeaderToolbar,
> I see that I would need to pass the DataTable and the
> SortableDataProvider to my TotalsToolbar.

yes.. correct.

> But, how would the toolbar get the data to display?

public class TotalCounter extends AbstractToolbar
{

public TotalCounter(final DataTable dataTable)
{

IModel<Integer> model=new LoadabledDetachedModel<Integer>()
{
  public Integer load()
  {
    return dataTable.size()
  }
}

WebMarkupContainer span = new WebMarkupContainer("span");
add(span);
span.add(new AttributeModifier("colspan", true, new Model<String>(
                        String.valueOf(table.getColumns().length))));

span.add(new Label("count",model));
}

> What would the html markup for this toolbar be like?

<wicket:panel>
  <tr class="navigation">
    <td wicket:id="span">
      <span wicket:id="counter"></counter>    
    </td>
  </tr>
</wicket:panel>
 

> Would greatly appreciate if someone could please provide some sample
> code.

maybe this will work out of the box, but not sure.. 
(have a look into the wicket code.. .. it will help a lot)

mm:)


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to