Yii2-如何在我的GridView中格式化页脚?
这是我的GridView的代码。我希望页脚与其列的格式相同。我该怎么做?谢谢Yii2-如何在我的GridView中格式化页脚?,gridview,yii2,footer,Gridview,Yii2,Footer,这是我的GridView的代码。我希望页脚与其列的格式相同。我该怎么做?谢谢 echo GridView::widget([ 'dataProvider' => $dataProvider, 'showFooter' => true, 'formatter' => ['class' => 'yii\i18n\Formatter','thousandSeparator' => ',','currencyCode' => 'PHP',], 'col
echo GridView::widget([
'dataProvider' => $dataProvider,
'showFooter' => true,
'formatter' => ['class' => 'yii\i18n\Formatter','thousandSeparator' => ',','currencyCode' => 'PHP',],
'columns' => [
['class' => 'yii\grid\SerialColumn'],
[
'attribute' =>'account_code',
'footer' =>'Total',
],
'account_name',
[
'attribute' =>'amount',
'format' => 'currency',
'footer' => Accounts::getTotal($dataProvider->models, 'amount'),
],
['class' => 'yii\grid\ActionColumn'],
],
]))
只需添加前缀
'footer' => 'PHP' . Accounts::getTotal($dataProvider->models, 'amount'),
对于千位分隔符,可以使用数字\格式
'footer' => 'PHP' .
number_format (Accounts::getTotal($dataProvider->models, 'amount'), 2 , "." , "," )
只需添加前缀
'footer' => 'PHP' . Accounts::getTotal($dataProvider->models, 'amount'),
对于千位分隔符,可以使用数字\格式
'footer' => 'PHP' .
number_format (Accounts::getTotal($dataProvider->models, 'amount'), 2 , "." , "," )
谢谢千分位怎么样?谢谢!千禧分离机怎么样?