Yii booster: how to render a cgridview inside a re

2019-06-14 08:54发布

问题:

I'm using boostrap library on Yii via yii-booster

I've created a relation table view

The related view is a TbGriView itself

Vhen in a row i click on the link on the 'related' column, the row expands itself, and render a TbGridview inside it.

The problem is that the internal gridview cannot be sorte, paged or filtered, because each action on it causes that the entire container grid will empty

Note - external grid as a id of 'extenalgrid' - each internal grid has as id like 'internalgrid-$rowId' , so every internal grid as differnt id on div, table and table row elements. - the action called from "render related tabel" link is using renderPartial without the postProcess option. If i use potProcess, the row will be empty

So is it not possible to rendere a full working gridview/tbgridview into a related table ?

回答1:

Use different css classes for the filters, buttons and headers for the different tables. From the jquery.yiigridview.js file events are bound to selectors as $('#table-id .selector-class') so elements in your internal gridView still trigger the events bound to the external gridView. You also have to specify a different url for the internal gridView by setting it's ajaxUrl.