Skip to content

Commit

Permalink
fix bug for exporter with more then 100 rows (#710)
Browse files Browse the repository at this point in the history
* fix bug for exporter with more then 100 rows

* changelog [skip ci]

* start index by 0
  • Loading branch information
nadar authored Apr 13, 2022
1 parent f5109c7 commit ab7cf58
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/).
In order to read more about upgrading and BC breaks have a look at the [UPGRADE Document](UPGRADE.md).

## 4.3.2
## 4.3.2 (13. April 2022)

+ [#710](https://github.com/luyadev/luya-module-admin/pull/710) Fixed a bug where it was not possible to export more then 100 rows when using `ngRestExport()` configuration.
+ [#709](https://github.com/luyadev/luya-module-admin/pull/709) Added `initvalue` for `zaaColor` element.
+ [#707](https://github.com/luyadev/luya-module-admin/pull/707) Fix issue when creating a new record inside an ngrest relation call form, losing they context data (from the relation).

Expand Down
8 changes: 5 additions & 3 deletions src/ngrest/base/Api.php
Original file line number Diff line number Diff line change
Expand Up @@ -869,15 +869,17 @@ private function formatExportValues(ActiveQuery $query, array $formatter)
{
Yii::$app->formatter->nullDisplay = '';
$data = [];
$rowId = 0;
foreach ($query->batch() as $batch) {
foreach ($batch as $key => $model) {
foreach ($batch as $model) {
foreach ($formatter as $formatterAttribute => $formatAs) {
if (is_callable($formatAs)) {
$data[$key][$formatterAttribute] = call_user_func($formatAs, $model);
$data[$rowId][$formatterAttribute] = call_user_func($formatAs, $model);
} else {
$data[$key][$formatterAttribute] = Yii::$app->formatter->format($model[$formatterAttribute], $formatAs);
$data[$rowId][$formatterAttribute] = Yii::$app->formatter->format($model[$formatterAttribute], $formatAs);
}
}
$rowId++;
}
}

Expand Down

0 comments on commit ab7cf58

Please sign in to comment.