【问题标题】:How to add additional row in yii cgridview <thead></thead>如何在 yii cgridview <thead></thead> 中添加额外的行
【发布时间】:2013-12-31 07:55:15
【问题描述】:

我想添加额外的行,例如 and ,thead-2 有空单元格。这些空单元格将用于我的表格中的“collspan”。

这是我现在的桌子:

https://dl.dropboxusercontent.com/u/10002593/Screenshot%20from%202013-12-31%2008%3A43%3A55.png

所以我想达到的效果:

https://dl.dropboxusercontent.com/u/10002593/output.jpg

谢谢,

【问题讨论】:

    标签: yii row cgridview


    【解决方案1】:

    我认为唯一的方法是创建自己的CGridView 类并覆盖renderTableHeader() 方法。像这样创建你的类:

    <?php
        Yii::import('zii.widgets.grid.CGridView');
        class MyGridView extends CGridView {
            public function renderTableHeader() {
            // Your own table header logic here
            }
        }
    ?>
    

    看一下 Yii 源代码,看看默认渲染是如何完成的: https://github.com/yiisoft/yii/blob/1.1.14/framework/zii/widgets/grid/CGridView.php#L495

    【讨论】:

    • 好的,但是怎么叫一张桌子呢? widget('zii.widgets.grid.CGridView', array(....
    猜你喜欢
    • 1970-01-01
    • 2012-09-28
    • 1970-01-01
    • 2011-01-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-09-23
    • 1970-01-01
    相关资源
    最近更新 更多