Jeremy, I am not really sure what you mean by using a model that gets the
columns on every repaint, but here's how I have changed my code now.

    public TotalsToolbar(final DataTable table, final IModel
dataProviderModel)
    {
        super(table);

        WebMarkupContainer totals = new WebMarkupContainer("totals");
        add(totals);

        AbstractReportingBean row =
(AbstractReportingBean)dataProviderModel.getObject();

        List<String> totalList = new ArrayList<String>();
        final IColumn[] columns = table.getColumns();
        for (int i = 0; i < columns.length; i++)
        {
           final IColumn column = columns[i];
           String val =
row.getStringForFieldNamed(column.getSortProperty());
           if (val == null || val.length() == 0) {
               val = "&nbsp;";
           }
           totalList.add(val);
        }

        ListView listView = new ListView("total", totalList){
            protected void populateItem(ListItem item) {
                String totalItem = (String) item.getModelObject();
                item.add(new Label("value",
totalItem.getValue()).setEscapeModelStrings(false));
            }
        };

        totals.add(listView);
        return;
    }

I changed the way I was creating my toolbar to use a model wrapped around
the data.

    public GrandTotalsDataTable(String id, final List columns,
            ISortableDataProvider sortableDataProvider, IDataProvider
dataProvider,
            int rowsPerPage)
    {
        super(id, columns, sortableDataProvider, rowsPerPage);
        addBottomToolbar(new TotalsToolbar(this,
dataProvider.model(dataProvider.iterator(0, 1).next())));
    }

And, here is my markup for the TotalsToolbar:
<wicket:panel>
  <tr>
    [span wicket:id="totals">
      <td wicket:id="total">
          [span wicket:id="value">[amount][/span>
      </td>
    [/span>
  </tr>
</wicket:panel>

(Changing the '<' before span tags to display it).

BTW, I tried to put breakpoints like you suggested, but interestingly when I
hit F5, the debugger doesn't hit any of my code. I do see the table being
updated though...

Thanks.
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Force-toolbar-to-update-on-page-refresh-tp2233347p2233773.html
Sent from the Wicket - User mailing list archive at Nabble.com.

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

Reply via email to