How to sum up the column data in CGridView

CGridView widget is great, powerful, I am wondering how to sum up one column to put into the footer, since it has default pagination, is there a way to set some parameter so the gridview can show the page sum and total sum at the footer cell ?

Currently , I pass the total sum to the view and put it in the footer, however I can not figure out how to do the page sum

if you want to put summary row on the footer maybe you can use template properties in cgridview :

$this->widget('zii.widgets.grid.CGridView', array(







	'summaryText'=>'total : {start} to {end} from {count}',

	'template'=>' {items} {summary} {pager}',  // use this


i hope it help… :mellow:

See here:

That is what I am looking for, I am expecting that a new attribute can be put into CDataColumn, so it can calculate the total sum for that column with pagination and sorting


Hey Fastcrash, thank you for the tip. It is not what I am looking for, however I really appreciate your help

how did you sum the items in your grid view?