php - Yii Booster TbTotalSumColumn formatted as currency -
i using yii booster, , 1 of widgets tbtotalsumcolumn.
when renders total in footer, uses following code:
echo $this->totalvalue? $this->evaluateexpression($this->totalvalue, array('total'=>$this->total)) : $this->grid->getformatter()->format($this->total, $this->type);
i have used cformatter , created 'currency' type, have applied formatting directly in 'value' attribute, have gone widget , applied currency formatter there. seems no matter do, can either values in column formatted currency, or footer, never both.
any appreciated.
i created new class file in components folder called tbtotalcolumncurrency.php. call tbtotalsumcolumncurrency in tbextendedgridview code.
yii::import('bootstrap.widgets.tbtotalsumcolumn'); class tbtotalsumcolumncurrency extends tbtotalsumcolumn { protected function renderfootercellcontent() { if(is_null($this->total)) return parent::renderfootercellcontent(); echo $this->totalvalue? $this->evaluateexpression($this->totalvalue, array('total'=>number_format($this->total), 2, '.', '')) : $this->grid->getformatter()->format(number_format($this->total, 2, '.', ''), $this->type); } }
hope helps
array( 'name'=>'total', 'type'=>'text', 'value'=>'number_format($data->price*$data->quantity, 2, \'.\', \'\')', 'class'=>'tbtotalsumcolumncurrency' ),
Comments
Post a Comment