Skip to content

Commit

Permalink
adjusted search to starts with
Browse files Browse the repository at this point in the history
  • Loading branch information
emagombe committed Oct 2, 2020
1 parent 1f5bffd commit 692b4be
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/DataTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ private function search($result) {
foreach($params["columns"] as $column) {
if($column["data"] == $key && $column["searchable"] == "true") {
/* Check if contains search key */
if(strpos($value, $request_search_query) !== false) {
if(strpos($value, $request_search_query) === 0) {
$filtered_result[] = $row;
$break = true;
break;
Expand Down Expand Up @@ -253,7 +253,7 @@ private function search_column($result) {
foreach($params["columns"] as $column) {
if($column["searchable"] == "true" && isset($row[$column["data"]]) && $row[$column["data"]]) {
if($column["search"]["value"] != "") {
if(strpos($row[$column["data"]], $column["search"]["value"]) !== false) {
if(strpos($row[$column["data"]], $column["search"]["value"]) === 0) {
$found = true;
} else {
$found = false;
Expand Down

0 comments on commit 692b4be

Please sign in to comment.