PDA

View Full Version : How create Total(Calculate) Row



Xcar
13 Jun 2007, 8:24 AM
Is there a way to calculate a numeric total for a single column? E.G, I have a row that displays some amount of money, and I want to totalize that row and display it anywhere in my form.

Thank You Very much


Xcar

tryanDLS
13 Jun 2007, 8:33 AM
You could just write a loop to go thru the store and total the values - maybe a load handler. You could also probably do it in a custom render fn - update a running total to some variable.

Xcar
13 Jun 2007, 8:54 AM
Hey dude, but is it possible to add that totalizer as a GridFoot or something like that? I apreciate your help! ~o)~o)

tryanDLS
13 Jun 2007, 9:05 AM
There's nothing built in to do totals in a footer, but you could do it yourself. In fact there may be something in Examples - you can build whatever you want in the footer panel - the same way the paging example does.

FritFrut
13 Jun 2007, 2:29 PM
There's nothing built in to do totals in a footer, but you could do it yourself. In fact there may be something in Examples - you can build whatever you want in the footer panel - the same way the paging example does.
Hmm, I don't think it's a good way... I might be wrong, but I think that resizing/removing/reordering columns in grid will not reflect to anything in the footer panel.
There was an example somewhere, with adding a Record to the Store, with sums/averages for the column. This is a bit better, but has a problem with sorting etc.
Hopefully, a new Grid/GridView will have an option to have a footer row which will not be databound, will not participate in sorting, etc, but will still use the same column model. There are many uses for such a feature, like totals, but also to repeat column headers (for a long grids), or, my favourite, to have a quick data entry form, similar to Access, OpenOffice Base etc.

SteveEisner
20 Jun 2007, 4:23 PM
Seconded -- this idea is really necessary for both totals and "add a new row" functionality