{"action":"created","issue":{"url":"https://api.github.com/repos/kartik-v/yii2-grid/issues/409","labels_url":"https://api.github.com/repos/kartik-v/yii2-grid/issues/409/labels{/name}","comments_url":"https://api.github.com/repos/kartik-v/yii2-grid/issues/409/comments","events_url":"https://api.github.com/repos/kartik-v/yii2-grid/issues/409/events","html_url":"https://github.com/kartik-v/yii2-grid/issues/409","id":119626588,"number":409,"title":"Gridview - ExpandRowColumn: Loading a subgrid using detailUrl","user":{"login":"jeffrico","id":3632182,"avatar_url":"https://avatars.githubusercontent.com/u/3632182?v=3","gravatar_id":"","url":"https://api.github.com/users/jeffrico","html_url":"https://github.com/jeffrico","followers_url":"https://api.github.com/users/jeffrico/followers","following_url":"https://api.github.com/users/jeffrico/following{/other_user}","gists_url":"https://api.github.com/users/jeffrico/gists{/gist_id}","starred_url":"https://api.github.com/users/jeffrico/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeffrico/subscriptions","organizations_url":"https://api.github.com/users/jeffrico/orgs","repos_url":"https://api.github.com/users/jeffrico/repos","events_url":"https://api.github.com/users/jeffrico/events{/privacy}","received_events_url":"https://api.github.com/users/jeffrico/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-12-01T02:24:02Z","updated_at":"2015-12-05T12:12:06Z","closed_at":"2015-12-05T12:10:46Z","body":"I am using Yii2 and struggling to load a GridView (kartik\\grid\\GridView)  from within a an ExpandRowColumn (kartik\\grid\\ExpandRowColumn) in a master Gridview using the detailUrl option.\r\n\r\nEverything works fine when using the detail option, which loads all subgrids on page-load which destroys page load times. Using the detailUrl option, the subgrid loads properly, however pagination and sorting on the subgrids malfunction, as seemingly the javascript which is registered on with a Gridview on a normal page-load, does not seem available.\r\n\r\nMy code:\r\n\r\n**ExpandableRowColumn**\r\n\r\n    $this->columns[] = [\r\n\r\n                    'class' => 'kartik\\grid\\ExpandRowColumn',\r\n                    'expandOneOnly' => true,\r\n                    'width' => '50px',\r\n                    'visible' => true,\r\n                    'order' => DynaGrid::ORDER_FIX_LEFT,\r\n                    'value' => function ($model, $key, $index, $column) {\r\n                        return GridView::ROW_COLLAPSED;\r\n                    },\r\n                    'detailUrl' => Yii::$app->urlManager->createUrl(['/' . Yii::$app->controller->id . '/sector-details', 'filter' => $this->getSubgridFilter()]),\r\n\r\n                    /*\r\n                      //Proper functioning code using detail option\r\n                      'detail' => function ($model, $key, $index, $column) {\r\n                      $searchModel = new \\app\\models\\search\\Subject;\r\n                      $searchModel->bySector = $key;\r\n                      $dataProvider = $searchModel->search($this->getSubGridFilter());\r\n                      return Yii::$app->controller->renderPartial('/linkage/_subgrid', [\r\n                      'searchModel' => $searchModel,\r\n                      'dataProvider' => $dataProvider,\r\n                      'gridId' => $key,\r\n                      ]);\r\n                      },\r\n                     * \r\n                     */\r\n                ];\r\n\r\n\r\n**Controller Action**\r\n\r\n    public function actionSectorDetails(array $filter = [])\r\n    {\r\n        if (isset($_POST['expandRowKey'])) {\r\n            $sectorId = $_POST['expandRowKey'];\r\n            $searchModel = $this->_initSearch();\r\n            $searchModel->bySector = $sectorId;\r\n            $dataProvider = $searchModel->search($filter);\r\n            return $this->renderAjax('/linkage/_subgrid', [\r\n                        'searchModel' => $searchModel,\r\n                        'dataProvider' => $dataProvider,\r\n                        'gridId' => $sectorId,\r\n            ]);\r\n        } else {\r\n            return '<div class=\"alert alert-danger\">No data found</div>';\r\n        }\r\n    }\r\n\r\n**Gridview**\r\n\r\n    //ID examples: actor-subgrid-x\r\n    $gridId = Yii::$app->controller->id . '-subgrid-' . $gridId;\r\n    $glyph = app\\helpers\\IconHelper::getIcon($caller);\r\n    \r\n    \r\n    \r\n    $gridConfig = [\r\n        'simple' => true,\r\n        'id' => $gridId . '-inner',\r\n        'title' => $title,\r\n        'model' => $searchModel,\r\n        'provider' => $dataProvider,\r\n        'pagerOptions' => ['linkOptions' => ['class' => 'item-link']]\r\n    ];\r\n    ?>\r\n    \r\n    <div class=\"row\">\r\n        <div class=\"col⁻xs-12\">\r\n            <?php\r\n            Pjax::begin(['id' => $gridId, 'enablePushState' => false]);\r\n            DynaGrid::widget([\r\n                        'columns' => $this->columns,\r\n                        'storage' => DynaGrid::TYPE_COOKIE,\r\n                        'theme' => $this->theme,\r\n                        'userSpecific' => false,\r\n                        'showPersonalize' => false,\r\n                        'showFilter' => false,\r\n                        'showSort' => false,\r\n                        'allowThemeSetting' => false,\r\n                        'gridOptions' => $this->gridOptions,\r\n                        'options' => ['id' => $gridId], // a unique identifier is important\r\n            ]);\r\n            Pjax::end()\r\n            ?>\r\n        </div>\r\n    </div>\r\n\r\n\r\n\r\nThe problem is,whenever I click a pagination or a sorting link, it redirects to the link called by the detailUrl, i.e. sector-details, rather than the main controller action. \r\n\r\nThe javascript handling the PJAX to catch subgrid pagination and sorting does not seem loaded... \r\n\r\nHow can I fully load a Gridview using renderAjax and detailUrl?\r\nI do see you've previously mentioned that detail should be used, but the performance truly is an issue...\r\n\r\nWhy exactly isn't this working, and what are the potential work-arounds...\r\n\r\nPlease Help!!\r\n\r\n\r\n\r\nHow can I get this sorted out\r\n"},"comment":{"url":"https://api.github.com/repos/kartik-v/yii2-grid/issues/comments/162176544","html_url":"https://github.com/kartik-v/yii2-grid/issues/409#issuecomment-162176544","issue_url":"https://api.github.com/repos/kartik-v/yii2-grid/issues/409","id":162176544,"user":{"login":"kartik-v","id":3592619,"avatar_url":"https://avatars.githubusercontent.com/u/3592619?v=3","gravatar_id":"","url":"https://api.github.com/users/kartik-v","html_url":"https://github.com/kartik-v","followers_url":"https://api.github.com/users/kartik-v/followers","following_url":"https://api.github.com/users/kartik-v/following{/other_user}","gists_url":"https://api.github.com/users/kartik-v/gists{/gist_id}","starred_url":"https://api.github.com/users/kartik-v/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kartik-v/subscriptions","organizations_url":"https://api.github.com/users/kartik-v/orgs","repos_url":"https://api.github.com/users/kartik-v/repos","events_url":"https://api.github.com/users/kartik-v/events{/privacy}","received_events_url":"https://api.github.com/users/kartik-v/received_events","type":"User","site_admin":false},"created_at":"2015-12-05T12:12:06Z","updated_at":"2015-12-05T12:12:06Z","body":"For any further help and tips, you can search for and ask for programming [help and questions in the forums here](http://webtips.krajee.com/questions). "}}