A
A
Airslip2017-04-05 13:40:25
Yii
Airslip, 2017-04-05 13:40:25

How to add button in gridview filter?

There is a table output code in Yii2.

<?= GridView::widget([
        'dataProvider' => $dataProvider,
        'filterModel' => $searchModel,
        'layout'=>"{items}",
        'columns' => [
            [
                'label'=>'Название',
                'attribute'=>'name',
                'format' => 'raw',
                'value'=>function ($data) {
                    $typeURLs = [
                        1 => 'open',
                        2 => 'close',
                        3 => 'channel',
                        4 => 'bot',
                    ];
                    $viewLink = (isset($typeURLs[$data->type]) && isset($data->slug)) ? '/'.$typeURLs[$data->type].'/'.$data->slug : '#';
                    return Html::a($data->name,'http://t-c.ru'.$viewLink);
                },
            ],
           // 'description:ntext',
        ],
    ]); ?>

I need to add a button next to the input line (as in the screenshot). How can you customize it?
7f14784c047b41048370ad11eb22861b.JPG

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
padlyuck, 2017-04-05
@Airslip

look away

<?= GridView::widget([
...
        'columns' => [
            [
                'label'=>'Название',
                'filter'=>'тут хтмл вашего поля ввода с кнопкой', //вот это вам скорее всего нужно
...
            ],
           // 'description:ntext',
        ],
    ]); ?>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question