Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ExpandRowColumn child grid not expanding #1081

Open
8 tasks
davidpeetoom opened this issue Nov 20, 2023 · 0 comments
Open
8 tasks

ExpandRowColumn child grid not expanding #1081

davidpeetoom opened this issue Nov 20, 2023 · 0 comments

Comments

@davidpeetoom
Copy link

davidpeetoom commented Nov 20, 2023

Prerequisites

  • [x ] I have searched for similar issues in both open and closed tickets and cannot find a duplicate.
  • [x ] The issue still exists against the latest master branch of yii2-grid.
  • [x ] This is not an usage question. I confirm having gone through and read the documentation and demos.
  • [x ] This is not a general programming / coding question. (Those should be directed to the webtips Q & A forum).
  • [x ] I have attempted to find the simplest possible steps to reproduce the issue.
  • [ x] I have included a failing test as a pull request (Optional).

Steps to reproduce the issue

  1. write the following code in a yii2 view:
$models1 = [['id' => 1, 'name' => 'test 1 level 1', 'level' => 1], ['id' => 2, 'name' => 'test 2 level 1', 'level' => 1]];

$models2 = [['id' => 3, 'name' => 'test 3 level 2', 'level' => 2], ['id' => 4, 'name' => 'test 4 level 2', 'level' => 2]];

$dataProvider1 = new \yii\data\ArrayDataProvider(['allModels' => $models1]);
$dataProvider2 = new \yii\data\ArrayDataProvider(['allModels' => $models2]);

echo GridView::widget([
    'dataProvider' => $dataProvider1,
    'columns' => [
        'id',
        'name',
        'level',
        [
            'columnKey' => uniqid(),
            'class' => \kartik\grid\ExpandRowColumn::class,
            'value' => function ($model, $key, $index, $column) {
                return \kartik\grid\GridView::ROW_COLLAPSED;
            },
            'detail' => function ($model, $key, $index, $column) use ($dataProvider2) {
                return \kartik\grid\GridView::widget([
                    'dataProvider' => $dataProvider2,
                    'columns' => [
                        'id',
                        'name',
                        'level',
                        [
                            'columnKey' => uniqid(),
                            'class' => \kartik\grid\ExpandRowColumn::class,
                            'value' => function ($model, $key, $index, $column) {
                                return \kartik\grid\GridView::ROW_COLLAPSED;
                            },
                            'detail' => function ($model, $key, $index, $column) {
                                return 'Extra row';
                            },
                        ],
                    ],
                ]);
            },
        ],
    ],
]);

Expected behavior and actual behavior

The first gridview expands correctly, but the second one does not. The buttons are not working.

Environment

Browsers

  • [ x] Google Chrome
  • Mozilla Firefox
  • Internet Explorer
  • Safari

Operating System

  • [x ] Windows
  • Mac OS X
  • Linux
  • Mobile

Libraries

  • jQuery version: 3.6
  • yii2-grid version: 3.5.3

Isolating the problem

  • This bug happens on the demos page
  • The bug happens consistently across all tested browsers
  • [ x] This bug happens when using yii2-grid without other plugins.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant