Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT SUM(precio) AS totalprecio FROM productos
- <?= yiigridGridView::widget([
- 'dataProvider' => $dataProvider,
- 'showFooter' => true,
- 'columns' => [
- ['attribute' => 'precio',
- 'footer' => sumarizeFooter( $dataProvider->getModels() ),
- 'format' => 'raw',
- ],
- ]
- ]) ?>
- function sumarizeFooter($model){
- $iSum = 0;
- foreach ($model as $obj){
- $iSum += floatval($obj->precio);
- }
- return $iSum;
- }
Add Comment
Please, Sign In to add comment