S
S
Sergey Beloventsev2016-09-21 08:53:23
Nginx
Sergey Beloventsev, 2016-09-21 08:53:23

How to add fields to GridView?

there is such a code

if(is_array($color)){$colorDatas=ArrayHelper::map($color,'id','value');}

now I need to add the following widget to 'columns' if $colorDatas is not empty
[
                    'filter'    =>Select2::widget ([
                        'model'         =>  $searchModel,
                        'attribute'     =>  'color',
                        'data'          => $colorDatas,
                        'language'  => 'ru',
                        'options'   => ['multiple' => true,'placeholder' => Yii::t('backend','SELECT_SHOP')],
                        'pluginOptions' => [
                            'allowClear' => true
                        ],
                    ]),
                    'attribute'   => 'color',
                    'value'       =>    function($model){
                        return $model->theGetValue($model);
                    }
                ],

in GridView do not tell me how to do it

Answer the question

In order to leave comments, you need to log in

3 answer(s)
N
nepster-web, 2016-09-03
@nepster-web

Server:

# 301 редирект со страниц со слешем на страницы без слеша в конце URL
rewrite ^/(.*)/$ /$1 permanent;

V
Vladimir Sergienko, 2020-06-29
@aixman

This is the construction that works in htacess for Latin URLs. It did not work with Cyrillic (( Like the answer above, it also did not work with Cyrillic in the URL
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} ^(.+)/$
RewriteRule ^(.+)/$ /$1 [R =301,L]

M
Maxim Fedorov, 2016-09-21
@Sergalas

to display a widget in a column, you can use the content property of the column class

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question