这是我的代码
$provider = new ActiveDataProvider([
'query' => $model->getReservations($start_time, $end_time),
'pagination' => [
'defaultPageSize' => 2 ,
'pageSize' => 2,
'pageSizeLimit' => [1, 2],
],
]);
return $links = $provider->getLinks();
它给我这个错误
Calling unknown method: yii\\data\\ActiveDataProvider::getLinks()
我如何获得gpagination的链接
答案 0 :(得分:0)
首先,您必须通过Pagination
方法获取getPagination()
个对象。然后,对象Pagination
有方法getLinks()
,所以:
return $links = $provider->pagination->links;
OR
return $links = $provider->getPagination()->getLinks();