I have a yii2 list view in my website.And i have to load around 5000 records. My search filter is like
$query = Car::find();
$dataProvider = new ActiveDataProvider([
'query' => $query,
'pagination' => [
'pageSize' => 10,
],
]);
$this->load($params);
I have applied a page size of 10 to the active data provider.But still the page loads the entire 5000 records.So taking too much time to load the web page. I want to load 10 records first fast and then each pages through pagination.
As Documentation says this must be a pagesize
property, not a pageSize
. Here is the link: Class yii\\data\\ActiveDataProvider Try to change this:
$dataProvider = new ActiveDataProvider([
'query' => $query,
'pagination' => [
'pageSize' => 10,
],
]);
to this:
$dataProvider = new ActiveDataProvider([
'query' => $query,
'pagination' => [
'pagesize' => 10,//<---------
],
]);
Hope it helps.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.