一个视图中有两个 GridView [英] Two GridViews in one view

查看:28
本文介绍了一个视图中有两个 GridView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用 Yii2 框架开发了一个网站,我需要一些帮助.我需要在我的一个页面中显示两个具有不同数据的不同 GridView.我设法显示了表格及其数据,但是当我从一个表格的页面切换到另一个表格时,其他表格的页面也会发生变化.

I developed a web site with Yii2 framework and I need some help. I need to show two different GridViews with different data in one of my pages. I managed to show the tables and their data, but when I switch from the page of one table to another, the pages the other tables change too.

如何在一张桌子上工作而不让其他人参与?(我正在使用来自 Kartik-v 的 yii2-grid)

How can I work on one table without get the others one involved? (I'm using yii2-grid from Kartik-v)

<?= GridView::widget([
  'dataProvider' => $dataProvider1,
  'filterModel'  => $searchModel1,
  'columns'      => $this->context->columnDefaultList($parm1),
]); ?>

<hr class="page_separator"/>

<?= GridView::widget([
 'dataProvider' => $dataProvider2,
 'filterModel'  => $searchModel2,
 'columns'      => $this->context->columnDefaultList($Parm2),
]); ?>

推荐答案

Configure You Dataprovider as

Configure You Dataprovider as

 $dataprovider1->pagination->pageParam = 'dp1';
 $dataprovider1->pagination->pageSizeParam = 'dp1-size';

 $dataprovider2->pagination->pageParam = 'dp2';
 $dataprovider2->pagination->pageSizeParam = 'dp2-size';

这篇关于一个视图中有两个 GridView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆