We populate a gridview with numerical data derived from an SQL function. The data is US currency values, displayed to two decimal places, right-justified. This data looks good. A second SQL function calculates the sums of this gridview column data. We display the summation values just below the gridview. The issue is that we cannot position these summation values exactly below their respective columns. The vertical alignment may be close at one screen resolution but it will be out of place at another resolution.
There must be some built-in gridview feature that will sum the column values and display the value in the correct position below the gridview? If so, can you point me towards the Yii documentation for that feature? Or if that feature does not exist, how would I go about placing data exactly below a gridview column. We would also like to place numeric values directly above the gridview columns, on top of the gridview frame, that also perfectly align with the column data.
Yii 1.x CGridView does not have a built-in feature to automatically display column totals (footer sums) aligned under columns. That alignment issue you’re facing is common when people try to place totals outside the grid.
Best solution (recommended)
Use footer in CGridView columns
Yii already supports a column footer, which stays perfectly aligned with each column.