jqh %!s(int64=5) %!d(string=hai) anos
pai
achega
dcfaf67f07

+ 12 - 2
src/Grid.php

@@ -418,8 +418,6 @@ HTML
 
         $this->buildRows($data);
 
-        $this->built = true;
-
         if ($data && $this->responsive) {
             $this->responsive->build();
         }
@@ -427,6 +425,18 @@ HTML
         $this->sortHeaders();
     }
 
+    /**
+     * @return void
+     */
+    protected function callBuilder()
+    {
+        if ($this->builder && ! $this->built) {
+            call_user_func($this->builder, $this);
+        }
+
+        $this->built = true;
+    }
+
     /**
      * Build the grid rows.
      *

+ 1 - 5
src/Grid/Concerns/HasExporter.php

@@ -57,11 +57,7 @@ trait HasExporter
             return;
         }
 
-        if ($this->builder) {
-            call_user_func($this->builder, $this);
-
-            $this->builder = null;
-        }
+        $this->callBuilder();
 
         // clear output buffer.
         if (ob_get_length()) {

+ 1 - 3
src/Grid/Concerns/HasFilter.php

@@ -34,9 +34,7 @@ trait HasFilter
      */
     public function processFilter($toArray = true)
     {
-        if ($this->builder) {
-            call_user_func($this->builder, $this);
-        }
+        $this->callBuilder();
 
         $this->applyQuickSearch();
         $this->applyColumnFilter();

+ 1 - 1
src/Grid/Exporters/AbstractExporter.php

@@ -209,7 +209,7 @@ abstract class AbstractExporter implements ExporterInterface
             $model->forPage($page, $perPage);
         }
 
-        $array = $this->grid->filter()->execute(true);
+        $array = $this->grid->processFilter(true);
 
         $model->reset();
         $model->rejectQueries('forPage');