J
J
justyork2016-07-28 10:57:27
Yii
justyork, 2016-07-28 10:57:27

How to configure global config for CGridView?

Hello everyone, tell me how to set up a global config for CGridView for buttons. I want the button template to be {edit} {delete} by default. I tried to do it in the config in the components, but it did not help. Well, accordingly, make your default buttons

'widgetFactory'=>array(
    'widgets'=>[
        'CGridView'=>[
            'cssFile' => Yii::app()->request->baseUrl.'/protected/modules/admin/assets/css/gridview.css',
            'itemsCssClass' => 'table table-striped table-bordered table-hover',
        ],
        'CButtonColumn' =>[
            'template'  => '{edit} {delete}',
         ]
    ],
),

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
Evgeny Bukharev, 2016-07-28
@justyork

Derivate from CGridView , and already in your class specify the required parameters, also in addition to CGridView, you need to inherit from CButtonColum to solve your problem

M
mitaichik, 2016-07-28
@mitaichik

Если вы про Yii2 - то там это настраевается через DI контейнер:
https://github.com/yiisoft/yii2/blob/master/docs/g...
widgetFactory - это в 1ом yii было, как там правильно - я уже не помню.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question