CGridView Footer

Hi i have this CGridView:


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

    'id' => 'encomenda-linha',

    'dataProvider' => $encomendaLinhasProvider,

    'htmlOptions' => array('style' => 'padding:0'),

    'columns' => array('ritmo.artist',

        'ritmo.title',

        array(

            'header' => Yii::t('app', 'Price'),

            'name' => 'ritmo.price',

            'htmlOptions' => array('style' => 'width:10px;'),

            'value' => '$data->ritmo->price." €"'

        ),

        array(

            'header' => Yii::t('app', 'Totals'),

            'name' => 'ritmo.price',

            'htmlOptions' => array('style' => 'width:10px;'),

            'footer' => CHtml::encode('$data->enc->totalValue').' €'

        ),

        array(

            'class' => 'CButtonColumn',

            'template' => '{delete}',

            'buttons' => array(

                'delete' => array(

                    

                    'url' => 'Yii::app()->createUrl("encomenda/deletelinha",array("id"=>$data->idencomenda_linha))',

                    'imageUrl' => Yii::app()->request->baseUrl . '/images/cross.png',

                    

            )),

            'deleteConfirmation'=>Yii::t('app','Are you sure you want to delete the style?'),

        )

    )

));



and this div summary:


<div style="float:right;">

    <table style="background-color: #5E747B">

        <tr>

            <td><?php echo Yii::t('app', 'Amount :') ?></td>

            <td style="text-align: right;"><?php echo $encomendaLinhasProvider->data[0]->enc->totalValue . ' €' ?></td>        

        </tr>

        <tr>

            <td><?php echo Yii::t('app', 'PayPal Fee (if aplicable) :') ?></td>

            <td style="text-align: right;"><?php $valor=$encomendaLinhasProvider->data[0]->enc->totalValue + ($encomendaLinhasProvider->data[0]->enc->totalValue * 3.4 / 100) + 0.35; 

                                                 echo number_format($valor, 2, ',', ' ') . ' €' ?></td>        

        </tr>


    </table>

</div>

what i want to do is to transform the div to the footer CGridView because when i delete an item of the CGridView the total amount of the footer has to be updated too.

What’s the best way to do this?

Any examples of code?

In your cGridview declaration, say under ‘htmlOptions’, you can add a call to your own function to update the total:




'afterAjaxUpdate'=> 'function(){updateTotal()}',



Yes but how to include the div in the footer?

you have already concatenated do it just wrap in a div