前两天在编码的过程中,发现使用dataProvider返回的数据条数很奇怪,跟设置的pageSize不一致,而且还是没有规律的那种:
/** @var $provider ActiveDataProvider*/
$provider = new ActiveDataProvider([
'query' => $query,
'pagination' => [
'page' => $currentPage - 1,
'pageSize' => $pageSize,
],
'sort' => [
'defaultOrder' => [
'order_id' => SORT_DESC,
]
]
]);
比如指定的pageSize是10,但是返回的不是10条,有的页码只有两条
返回结果
一直不知道原因,文档也查不到,搜索也无果,后来问了同事,需要在查询的query加上groupBy();
果真加上就好了,目前还不知道原理,先mark后面再看。
query 加上groupBy
结果正常了:
结果正常
本文由 HongXunPan 创作,采用 知识共享署名4.0 国际许可协议进行许可
本站文章除注明转载/出处外,均为本站原创或翻译,转载前请务必署名
最后编辑时间为:
2018-08-24 18:05:03
I love it whenever people get together and share views. Great blog, stick with it!
This is a topic that's close to my heart... Thank you! Exactly where are your contact details though?
Awesome post.
I really like it when individuals come together and share opinions. Great website, stick with it!
I was recommended this blog via my cousin. I am no longer positive whether this put up is written by way of him as no one else recognize such particular approximately my problem. You're incredible! Thank you!
plgrn.nl https://openproductdata.ch balance of nature Lucretia classicalmusicmp3freedownload.com