jqh 5 년 전
부모
커밋
dc4b37c8f2
1개의 변경된 파일10개의 추가작업 그리고 6개의 파일을 삭제
  1. 10 6
      src/Grid/Exporters/AbstractExporter.php

+ 10 - 6
src/Grid/Exporters/AbstractExporter.php

@@ -87,15 +87,19 @@ abstract class AbstractExporter implements ExporterInterface
     {
         $model = $this->grid->model();
 
-        $model->usePaginate(false);
+        // current page
+        if ($this->scope === Grid\Exporter::SCOPE_CURRENT_PAGE) {
+            $page    = $model->getCurrentPage();
+            $perPage = $model->getPageName();
+        }
+
         $model->reset();
+        $model->usePaginate(false);
 
-        if ($this->scope !== Grid\Exporter::SCOPE_SELECTED_ROWS) {
-            if ($page) {
-                $perPage = $perPage ?: $this->grid->option('export_chunk_size');
+        if ($page && $this->scope !== Grid\Exporter::SCOPE_SELECTED_ROWS) {
+            $perPage = $perPage ?: $this->grid->option('export_chunk_size');
 
-                $model->forPage($page, $perPage);
-            }
+            $model->forPage($page, $perPage);
         }
 
         return $this->data ?? $this->grid->getFilter()->execute(true);