From d2ff2a6223b7a93ac213ede02afb0d7f0c69eb48 Mon Sep 17 00:00:00 2001 From: Arjay Angeles Date: Wed, 1 Oct 2025 16:20:43 +0800 Subject: [PATCH 1/2] fix: ajax override via options --- src/Html/DataTableHtml.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Html/DataTableHtml.php b/src/Html/DataTableHtml.php index db73253..77a13a1 100644 --- a/src/Html/DataTableHtml.php +++ b/src/Html/DataTableHtml.php @@ -44,6 +44,8 @@ protected function getHtmlBuilder(): Builder $this->htmlBuilder = app(Builder::class); + $this->htmlBuilder->postAjax($this->ajax()); + $this->options($this->htmlBuilder); if ($this->buttons()) { @@ -67,7 +69,6 @@ public function handle(): Builder ->setTableId($this->tableId) ->selectSelector() ->selectStyleOs() - ->postAjax($this->ajax()) ->addScript('datatables::functions.batch_remove'); } From 1252e56d867f6d9a8b6f58e67b294ad6df9d11a3 Mon Sep 17 00:00:00 2001 From: Arjay Angeles Date: Wed, 1 Oct 2025 16:22:53 +0800 Subject: [PATCH 2/2] fix: default overrides via options --- src/Html/DataTableHtml.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/Html/DataTableHtml.php b/src/Html/DataTableHtml.php index 77a13a1..d107bdc 100644 --- a/src/Html/DataTableHtml.php +++ b/src/Html/DataTableHtml.php @@ -44,7 +44,12 @@ protected function getHtmlBuilder(): Builder $this->htmlBuilder = app(Builder::class); - $this->htmlBuilder->postAjax($this->ajax()); + $this->htmlBuilder + ->postAjax($this->ajax()) + ->setTableId($this->tableId) + ->selectSelector() + ->selectStyleOs() + ->addScript('datatables::functions.batch_remove'); $this->options($this->htmlBuilder); @@ -65,11 +70,7 @@ protected function getHtmlBuilder(): Builder public function handle(): Builder { - return $this->getHtmlBuilder() - ->setTableId($this->tableId) - ->selectSelector() - ->selectStyleOs() - ->addScript('datatables::functions.batch_remove'); + return $this->getHtmlBuilder(); } public function setHtmlBuilder(Builder $builder): static