From 0d9ff81a972b9a586c3a769cccffe12b0c6f8a76 Mon Sep 17 00:00:00 2001 From: DevSoftTech Server Date: Sat, 6 Jun 2026 14:56:02 +0530 Subject: [PATCH] Add DataTables search box support to patient search - now handles both initial search and live filtering --- app/Controllers/Patient.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/Controllers/Patient.php b/app/Controllers/Patient.php index 2a01bdb..71c713b 100644 --- a/app/Controllers/Patient.php +++ b/app/Controllers/Patient.php @@ -415,7 +415,13 @@ class Patient extends BaseController public function search_ajax() { $request = $this->request->getGet(); - $sdata = trim((string) ($request['search_query'] ?? '')); + + // Get search value from DataTables search box or from initial search_query + $dtSearch = trim((string) ($request['search']['value'] ?? '')); + $initialSearch = trim((string) ($request['search_query'] ?? '')); + + // Use DataTables search if provided, otherwise use initial search_query + $sdata = $dtSearch !== '' ? $dtSearch : $initialSearch; $sdata = preg_replace('/[^A-Za-z0-9 _.@\-]/', '', $sdata); // Detect ABHA column name in patient_master