mercredi 20 avril 2016

yii2 extend row column checkbox issue

i have an issue with kartik extend row column, when i use checkbox column. I have rbac permissions, and i want to use this grid to pair roles and rules to specified permissions. The issue is, when i click the checkbox in the header, the gridview check in all checkboxes, within the extend row too. And if i check in the header in the extend row, the gridview check the main grid checkboxes too. I have different id-s in my gridviews, but i dont know how to separate the main grid from the extend. So i want if i check the extend row header checkbox, then check in all checkboxes just in the extend.

My main gridview code is:
<?= GridView::widget([
        'dataProvider' => $dataProvider,
        'columns' => [
            [
                'class' => 'kartik\grid\ExpandRowColumn',
                'value' => function ($model, $key, $index, $column) {
                    return (Permission::getHasPermissionChild($model['name']) ? GridView::ROW_COLLAPSED : '');
                },
                'detailUrl' => Url::to(['permission/erc-permission-child']),
                'pageSummary' => false,
            ],
            [
                'class' => '\kartik\grid\CheckboxColumn',
                'rowSelectedClass' => GridView::TYPE_ACTIVE,
                'checkboxOptions' => function($model) {
                    return ['value' => $model['name']];
                },
            ],
            [
                'attribute' => 'name',
                'format' => 'raw'
            ],
            [
                'attribute' => 'description',
                'format' => 'raw'
            ],
        ],
        'responsive'=>true,
        'id' => 'role-permissions',
        'pjax' => false,
    ]); ?>

Extend row column gridview:
<?= GridView::widget([
    'dataProvider' => $dataProvider,
    'columns' => [
        [
            'class' => '\kartik\grid\CheckboxColumn',
            'rowSelectedClass' => GridView::TYPE_ACTIVE,
            'checkboxOptions' => function($model) {
                return ['value' => $model['name']];
            },
        ],
        [
            'attribute' => 'name',
            'format'=>'raw',
        ],
        [
            'attribute' => 'description',
            'format'=>'raw',
        ],
    ],
    'responsive'=>true,
    'id' => 'role-erc-permissions-grid',
]); ?>

screenshot from issue

Aucun commentaire:

Enregistrer un commentaire