kartik-v / yii2-grid

Enhanced GridView with various utilities for Yii Framework 2.0
http://demos.krajee.com/grid
Other
557 stars 302 forks source link

ExpandRowColumn fired on page load even it using detailurl #1008

Closed ivana-helvin closed 2 years ago

ivana-helvin commented 2 years ago

Hi, im using ExpandRowColumn for adding some information to user. I use detailUrl and as i read on documentation https://demos.krajee.com/grid#expand-row-column if i use detailUrl it will load via ajax when the row is expanded.

I have 2 problems:

  1. all row load the url on grid page load.
  2. when i click expand, no ajax fired

Here my code:

echo GridView::widget([
        //...
        'columns' => [
           [
                'class' => 'kartik\grid\ExpandRowColumn',
                'width' => '40px',
                //'enableCache' => false,
                'value' => function ($model, $key, $index) {
                    return GridView::ROW_COLLAPSED;
                },
                // uncomment below and comment detail if you need to render via ajax
                'detailUrl'=>Url::to(['/ordercustomer/lihatkembar']),                
                'headerOptions' => ['class' => 'kartik-sheet-style'],
                'expandOneOnly' => true
            ]
        ]
        //...
    ]);

Thank You.

Update: it only happend if i use "*" (i dont know which version actually) on my composer.json, but when i change to "@dev" it working.

kartik-v commented 2 years ago

It seems the issue you have is an old outdated install - check if you have the latest version from here on repo. Using @dev will generally load the latest version.

PS: you can cross check the version you have installed by opening one of the class files like GridView.php.