0
十進制格式我有這樣的代碼:
解決:在Yii中TBGridview
<?php
$this->widget('bootstrap.widgets.TbGridView',array(
'id'=>'appliances-grid',
'dataProvider'=>$model->search(),
'filter'=>$model,
'columns'=>array(
array(
'name'=>'price',
'type'=>'number',
'htmlOptions'=>array('style' => 'text-align: right;'),
),
array(
'class'=>'bootstrap.widgets.TbButtonColumn',
'template'=>'{update}{delete}'
),
),
));
?>
結果只有整數和搜索篩選器的工作,如何將它轉變成十進制格式,但搜索篩選器還工作嗎?
我試圖把它變成:
array(
'name'=>'price',
'type'=>'number',
'htmlOptions'=>array('style' => 'text-align: right;'),
'value'=>function($data)
{
return number_format($data->price,2,',','.');
},
),
但它使搜索過濾器工作不正常。