F
F
Finsh2015-12-14 11:27:58
Yii
Finsh, 2015-12-14 11:27:58

Yii2 Need to integrate widget into StarRating GridView?

There is a need to insert the StarRating widget into the GridView widget, how to do it?

GridView::widget([
        'dataProvider' => $dataProvider,
        'filterModel' => $searchModel,
        'responsiveWrap' => false,
        'columns' => [
            ['class' => 'yii\grid\SerialColumn'],
            [
                'header' => 'Тут ннннада звездочки',
                'value' => function($model){
                    return StarRating::widget([
                        'name' => 'rating_21',
                        'value' => 2,
                        'pluginOptions' => [
                            'readonly' => true,
                            'showClear' => false,
                            'showCaption' => false,
                        ],
                    ]);
                }
            ]
        ],
    ]);

I insert through a function, but it returns only HTML code to me, what should I do?
I use
1) kartik\grid\GridView
2) kartik\widgets\StarRating
cbc9f608c0a54adda085bb89a9188b0e.png
Thank you so much for your reply

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vit, 2015-12-14
@fornit1917

'type' => 'raw' or something like that should be added to the column parameters.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question