1

It's possible add code in action column to expand ExpandRowColumn like with anonymous function? I need add in this column total rows in each ExpandRowColumn like in in the following image.

enter image description here

example in expandIcon property:

[
    'class' => 'kartik\grid\ExpandRowColumn',
    'width' => '50px',
    'expandIcon' => function ($model, $key, $index, $column) {
        $total = Model::find()->where(['id_model' => $model->id])->count();
        return '<i class="fa fa-plus-square"></i> ' . $total;
    },
    'value' => function ($model, $key, $index, $column) {
        return GridView::ROW_COLLAPSED;
    },
    'detail' => function ($model, $key, $index, $column) {
        return Yii::$app->controller->renderPartial('_expand-row-details', ['model' => $model]);
    },
],
Moutinho
  • 339
  • 8
  • 22

0 Answers0