Skip to content

Commit

Permalink
Merge pull request kartik-v#309 from onmotion/fixBatchSize
Browse files Browse the repository at this point in the history
fix the loss of the first page if batchSize
  • Loading branch information
kartik-v authored Oct 8, 2019
2 parents fb3e25f + 4637261 commit 7dc1cf1
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/ExportMenu.php
Original file line number Diff line number Diff line change
Expand Up @@ -941,6 +941,11 @@ public function initExport()
/** @noinspection PhpUndefinedFieldInspection */
$this->_provider->pagination = clone($this->dataProvider->pagination);
$this->_provider->pagination->pageSize = $this->batchSize;
$this->_provider->refresh();
if (\Yii::$app->request->getBodyParam('exportFull_export')) {
$this->_provider->pagination->page = null;
\Yii::$app->request->setQueryParams([$this->_provider->pagination->pageParam => 1]);
}
} else {
$this->_provider->pagination = false;
}
Expand Down Expand Up @@ -1302,6 +1307,9 @@ public function generateBody()
$this->findGroupedColumn();
while (count($models) > 0) {
$keys = $this->_provider->getKeys();
if ($this->_provider instanceof ArrayDataProvider) {
$models = array_values($models);
}
foreach ($models as $index => $model) {
$key = $keys[$index];
$this->generateRow($model, $key, $this->_endRow);
Expand Down

0 comments on commit 7dc1cf1

Please sign in to comment.