Re: Displaying column totals for a DefaultDataTable

2009-09-16 Thread saahuja

Ok, here is my code for the TotalsToolbar that I am adding as a
BottomTooolbar to my table.

public class TotalsToolbar extends AbstractToolbar
{

public TotalsToolbar(final DataTable table, final IDataProvider
dataProvider)
{
super(table);

RepeatingView totals = new RepeatingView(totals);
add(totals);

final IColumn[] columns = table.getColumns();
for (int i = 0; i  columns.length; i++)
{
final IColumn column = columns[i];

WebMarkupContainer item = new
WebMarkupContainer(totals.newChildId());
totals.add(item);

WebMarkupContainer total = new WebMarkupContainer(total);

item.add(total);
item.setRenderBodyOnly(true);
if (i == 0)
total.add(new Label(value, Grand Total));
else
total.add(new Label(value, $0.00));

}
}

As you can see I am passing in a dataProvider into the constructor, but I do
not know how to use it. How do I replace the hardcoded $0.00 value (look
towards the end of the code) with a value coming from the dataProvider?

Thanks.
-- 
View this message in context: 
http://www.nabble.com/Displaying-column-totals-for-a-DefaultDataTable-tp25402522p25475784.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: Displaying column totals for a DefaultDataTable

2009-09-16 Thread saahuja

Sorry, never mind my previous post. I figured it out. I just need to use the
iterator() on the dataProvider to get the values.
Thanks.
-- 
View this message in context: 
http://www.nabble.com/Displaying-column-totals-for-a-DefaultDataTable-tp25402522p25477218.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: Displaying column totals for a DefaultDataTable

2009-09-11 Thread saahuja

Thanks for your reply, Michael.

Your code does work to display the number of columns in the dataTable, after
I changed dataTable.size() to dataTable.getRowCount(). It did help me in
getting started with writing my own toolbar.

However, my table has several amount columns and I want to display the sum
of the amounts in each column at the bottom of that column.

How should I do that? I am also passing in a SortableDataProvider into the
constructor of my Toolbar.

Thanks.


-- 
View this message in context: 
http://www.nabble.com/Displaying-column-totals-for-a-DefaultDataTable-tp25402522p25406289.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: Footer Toolbar for DefaultDataTable (wicket 1.3.2)

2009-09-04 Thread saahuja

Hi,

Does anyone have an example of a toolbar that would add the amounts in the
table?

Thanks.


swapnil.wadagave wrote:
 
 hi Sanjeev,
 I think you can able to do it using this code,
 
 extend parent class as DataTable,dont use DefaultDataTable :
 code:
 DatatTable datatable=new DataTable(entries,column,provider,3)
 {
 protected Item newRowItem(String id,int index,IModel model)
 {
 return new OddEvenItem(id,indexmmodel);
 }};
 datatable.addTopToolBar(new HeadersToolBar(datatble,provider));
 datatable.addBottomToolBar(new NavigationToolBar(datatble));
 add(datatable);
 
 Regards,
 Swapnil
 
 
 
 standon wrote:
 
 I'm using DefaultDataTable with sortable data provider in my project. All
 the columns are sortable. This  data table has few amount columns, which
 I need to sum up and show as a last row (TotalRow) at the bottom of the
 table. This last row (TotalRow) should not be part of sortable data
 provider. Otherwise, if user clicks on any table column, the table will
 sort it and put in top (1st row, descending order) of the table.
 
 Basically, the way the column headers are displayed on default data
 table, I want similar thing to be displayed at the bottom of the table
 (TotalRow), which I can control it. I don't know how to use
 addBottomToolbar to achieve this.
 
 If there is a way, pls let me know. If you can provide a code snippet
 that would be great.
 
 Thanks
 Sanjeev
 
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Footer-Toolbar-for-DefaultDataTable-%28wicket-1.3.2%29-tp16995010p25301509.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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