Yii booster:如何在关系表行中渲染 cgridview? [英] Yii booster: how to render a cgridview inside a relation table row?
问题描述
我通过 yii-booster 在 Yii 上使用 boostrap 库
I'm using boostrap library on Yii via yii-booster
我已经创建了一个关系表视图
I've created a relation table view
相关视图是一个 TbGriView 本身
The related view is a TbGriView itself
当我在一行中单击相关"列上的链接时,该行自身展开,并在其中呈现一个 TbGridview.
Vhen in a row i click on the link on the 'related' column, the row expands itself, and render a TbGridview inside it.
问题是内部gridview无法进行sorte、paged或filtering,因为对它的每一个action都会导致整个container grid都会清空
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
注意- 外部网格作为 'extenalgrid' 的 id- 每个内部网格都有像 'internalgrid-$rowId' 这样的 id,所以每个内部网格在 div、table 和 table 行元素上都有不同的 id.- 从渲染相关表格"链接调用的操作使用没有 postProcess 选项的 renderPartial.如果我使用potProcess,该行将为空
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
那么是否不可能将完整的工作 gridview/tbgridview 渲染到相关表中?
So is it not possible to rendere a full working gridview/tbgridview into a related table ?
推荐答案
对不同表格的过滤器、按钮和标题使用不同的 css
类.从 jquery.yiigridview.js
文件事件被绑定到选择器 $('#table-id .selector-class')
所以你内部 gridView 中的元素仍然触发绑定到外部 gridView 的事件.您还必须通过将其设置为 ajaxUrl
来为内部 gridView 指定不同的 url
.
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
.
这篇关于Yii booster:如何在关系表行中渲染 cgridview?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!