Customise grid view in yii2

前端 未结 5 855
一生所求
一生所求 2021-02-02 08:47

How to remove summary and sorter for a particular grid view in Yii2. In Yii1.1 we can do that by setting the template property. In yii2 how to achieve this?

5条回答
  •  无人共我
    2021-02-02 09:35

    [
        'class' => 'yii\grid\ActionColumn',
        'buttons' =>
            [
                'update'=>function($url,$model,$key)
                {
                    return Html::a( "update" , $url ); //use Url::to() in order to change $url
                },
                'view'=>function($url,$model,$key)
                {
                    return Html::a( "update" , $url ); //use Url::to() in order to change $url
                },
                'delete'=>function($url,$model,$key)
                {
                    return Html::a( "update" , $url, [
                        'class' => 'btn btn-lg btn-primary',
                        'data' => [
                            'method' => 'post',
                            'params' => ['derp' => 'herp'], // <- extra level
                        ],
                    ] ); //use Url::to() in order to change $url
                }
            ],
        'template' => '
    {update} {view} {delete}
    ', 'header' => 'Actions' ]

提交回复
热议问题