From cecf7f8ae04d99a6f69095e9306490352d280808 Mon Sep 17 00:00:00 2001 From: Ozan Kurt Date: Tue, 20 Aug 2024 22:01:24 +0200 Subject: [PATCH 1/5] Update DataTableAbstract.php --- src/DataTableAbstract.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/DataTableAbstract.php b/src/DataTableAbstract.php index d0c3ba21..6eedb198 100644 --- a/src/DataTableAbstract.php +++ b/src/DataTableAbstract.php @@ -524,6 +524,7 @@ public function setMultiTerm(bool $multiTerm = true): static public function setTotalRecords(int $total): static { $this->totalRecords = $total; + $this->performedTotalRecordsCount = true; return $this; } From 866f053e615c62619ffded83cbcc37f1ddff01e7 Mon Sep 17 00:00:00 2001 From: Ozan Kurt Date: Thu, 22 Aug 2024 11:57:56 +0200 Subject: [PATCH 2/5] Update QueryDataTableTest.php --- tests/Integration/QueryDataTableTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/Integration/QueryDataTableTest.php b/tests/Integration/QueryDataTableTest.php index d2b4a028..09c8f356 100644 --- a/tests/Integration/QueryDataTableTest.php +++ b/tests/Integration/QueryDataTableTest.php @@ -26,7 +26,7 @@ public function it_can_set_total_records() $crawler->assertJson([ 'draw' => 0, 'recordsTotal' => 10, - 'recordsFiltered' => 20, + 'recordsFiltered' => 10, ]); } @@ -37,7 +37,7 @@ public function it_can_set_zero_total_records() $crawler->assertJson([ 'draw' => 0, 'recordsTotal' => 0, - 'recordsFiltered' => 20, + 'recordsFiltered' => 0, ]); } From 132884184072c7fc7c4eb60a8f1a0854e104905f Mon Sep 17 00:00:00 2001 From: Ozan Kurt Date: Thu, 22 Aug 2024 12:05:34 +0200 Subject: [PATCH 3/5] Update DataTableAbstract.php --- src/DataTableAbstract.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/DataTableAbstract.php b/src/DataTableAbstract.php index 6eedb198..d0c3ba21 100644 --- a/src/DataTableAbstract.php +++ b/src/DataTableAbstract.php @@ -524,7 +524,6 @@ public function setMultiTerm(bool $multiTerm = true): static public function setTotalRecords(int $total): static { $this->totalRecords = $total; - $this->performedTotalRecordsCount = true; return $this; } From ed3ae13e6fb2733c8261b7a598f6eec3d3eb293c Mon Sep 17 00:00:00 2001 From: Ozan Kurt Date: Thu, 22 Aug 2024 12:06:35 +0200 Subject: [PATCH 4/5] Update QueryDataTable.php --- src/QueryDataTable.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/QueryDataTable.php b/src/QueryDataTable.php index aea42844..4db4dcbf 100644 --- a/src/QueryDataTable.php +++ b/src/QueryDataTable.php @@ -161,6 +161,19 @@ public function prepareQuery(): static return $this; } + + /** + * Set total records manually. + * + * @return $this + */ + public function setTotalRecords(int $total): static + { + parent::setTotalRecords($total); + $this->performedTotalRecordsCount = true; + + return $this; + } /** * Count total items. From 36bbf4a9717a684434ab34b72e8b8aec429b739a Mon Sep 17 00:00:00 2001 From: Ozan Kurt Date: Thu, 22 Aug 2024 12:08:21 +0200 Subject: [PATCH 5/5] Update QueryDataTable.php --- src/QueryDataTable.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/QueryDataTable.php b/src/QueryDataTable.php index 4db4dcbf..9dda5f14 100644 --- a/src/QueryDataTable.php +++ b/src/QueryDataTable.php @@ -161,7 +161,7 @@ public function prepareQuery(): static return $this; } - + /** * Set total records manually. *