Skip to content

Commit cb0e89e

Browse files
committed
Add sortSearch()
1 parent 27ce91a commit cb0e89e

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

src/BaseGridQuery.php

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,13 @@ abstract class BaseGridQuery
4545
*/
4646
protected $searchOperator = 'having';
4747

48+
/**
49+
* If searching will be sorted by sort_index.
50+
*
51+
* @var bool
52+
*/
53+
protected $sortSearch = true;
54+
4855
/**
4956
* Return the initialized specific query. This contains the joins logic and condition that make the query specific.
5057
*
@@ -279,7 +286,7 @@ public function searcher()
279286
return new SublimeSearch(
280287
$this->searchableQuery(),
281288
$this->searchOperator === 'having' ? $this->columnKeys() : array_values($this->columns()),
282-
true,
289+
$this->sortSearch,
283290
method_exists($this, 'sortColumns') ? $this->sortColumns() : $this->columns(),
284291
$this->searchOperator
285292
);
@@ -298,6 +305,19 @@ public function setSearchOperator($searchOperator)
298305
return $this;
299306
}
300307

308+
/**
309+
* Set sortSearch value.
310+
*
311+
* @param boolean $bool
312+
* @return $this
313+
*/
314+
public function sortSearch($sortSearch = true)
315+
{
316+
$this->sortSearch = $sortSearch;
317+
318+
return $this;
319+
}
320+
301321
/**
302322
* Initialize query.
303323
*

0 commit comments

Comments
 (0)