我想在表摘要中添加summarytext如何实现这一点?
有搜索这个api,但仍然无法理解。
我的看法:
<div>
<div class="bg-primary text-white">i want to this in summary text</div>
<?= GridView::widget([
'dataProvider' => $provider,
'summaryOptions' => [
'class' => 'bg-primary text-white',
],
'columns' => [
'id',
'address',
'email',
[
'class' => 'yii\grid\ActionColumn',
'header' => 'button',
'headerOptions' => ['style' => 'color:#337ab7'],
'template' => '{update}{delete}',
'buttons' => [
'update' => function ($url,$model) {
$url = Url::to(['controller/update', 'id' => $model->id]);
return Html::a('<span class="glyphicon glyphicon-pencil"></span>', $url, [
'title' => Yii::t('app', 'lead-update'),
]);
},
'delete' => function ($url, $model) {
$url = Url::to(['controller/delete', 'id' => $model->id]);
return Html::a('<span class="glyphicon glyphicon-trash"></span>', $url, [
'title' => Yii::t('app', 'lead-delete'),
]);
}
],
],
],
]);
?>
</div>
希望你的家伙可以帮助我谢谢!
分配你需要的值和一个构建函数var来检索你需要的值你需要的var(或函数)的页脚,并在你的网格配置中设置showFooter = TRUE
<?php
$mySummary ="i want to this in summary text";
echo GridView::widget([
'dataProvider' => $provider,
'showFooter'=>TRUE,
'summaryOptions' => [
'class' => 'bg-primary text-white',
],
'columns' => [
'id',
[
'attribute' => 'address',
'footer' => $mySummary,
]
'email',
.....
我找到了我想要的东西
'caption'=>'<h2>Javed</h2>',
'captionOptions' => [
'class' => 'bg-primary text-white',
],