2015-05-31 22:12:41 5903次浏览 1条回答 1 悬赏 2 金钱

使用yii2 生成管理列表,有 CheckboxColumns::className(),但这个“批量提交”的按钮是放到哪里?
GridView 中是无法控制的,类: GridView (D:\website\yii2\basic\vendor\yiisoft\yii2\grid\GridView.php) 方法 renderTableFooter

已经将GridView::widget([])里面加了 'showFooter' => true ,但是 GridView 的renderTableFooter() 却无法控制,如何生成 <tr><td colspan="30"><input type="submit" value="批量删除" /></td></tr>

D:\website\yii2\basic\vendor\yiisoft\yii2\grid\GridView.php

   /**
     * Renders the table footer.
     * @return string the rendering result.
     */
    public function renderTableFooter()
    {
        $cells = [];
        foreach ($this->columns as $column) {
            /* @var $column Column */
            $cells[] = $column->renderFooterCell();
        }
        $content = Html::tag('tr', implode('', $cells), $this->footerRowOptions);
        if ($this->filterPosition == self::FILTER_POS_FOOTER) {
            $content .= $this->renderFilters();
        }

        return "<tfoot>\n" . $content . "\n</tfoot>";
    }

foreach 这个里面已经无法控制 colunms 了,无法生成 colspan="30"

  • 回答于 2015-06-02 16:40 举报
    <script>
    	jQuery(document).ready(function($) {
    		$("需要添加节点的位置").append('<tr><td colspan="30"><input type="submit" value="批量删除" /></td></tr>')
    	});
    </script>
    
您需要登录后才可以回答。登录 | 立即注册
phptest
见习主管

phptest

注册时间:2014-06-08
最后登录:2018-12-03
在线时长:9小时54分
  • 粉丝5
  • 金钱118
  • 威望0
  • 积分208

热门问题