Skip to content

Commit 6557064

Browse files
authored
Merge pull request #197 from Seb33300/fix-ajax-action
fix: custom ajax action
2 parents 8f388e3 + 999ad17 commit 6557064

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/Services/DataTable.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -172,10 +172,6 @@ public function __construct()
172172
*/
173173
public function render(?string $view = null, array $data = [], array $mergeData = [])
174174
{
175-
if ($this->request()->ajax() && $this->request()->wantsJson()) {
176-
return app()->call($this->ajax(...));
177-
}
178-
179175
/** @var string $action */
180176
$action = $this->request()->get('action');
181177
$actionMethod = $action === 'print' ? 'printPreview' : $action;
@@ -187,6 +183,10 @@ public function render(?string $view = null, array $data = [], array $mergeData
187183
return app()->call($callback);
188184
}
189185

186+
if ($this->request()->ajax() && $this->request()->wantsJson()) {
187+
return app()->call($this->ajax(...));
188+
}
189+
190190
/** @phpstan-ignore-next-line */
191191
return view($view, $data, $mergeData)->with($this->dataTableVariable, $this->getHtmlBuilder());
192192
}

0 commit comments

Comments
 (0)