Skip to content

Commit

Permalink
fix issue #1356
Browse files Browse the repository at this point in the history
  • Loading branch information
z-song committed Oct 26, 2017
1 parent 2f914a4 commit 3876eaf
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/Grid/Filter.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,16 @@ public function disableIdFilter()
$this->useIdFilter = false;
}

/**
* Remove ID filter if needed.
*/
public function removeIDFilterIfNeeded()
{
if (!$this->useIdFilter) {
array_shift($this->filters);
}
}

/**
* Get all conditions of the filters.
*
Expand All @@ -129,6 +139,8 @@ public function conditions()

$conditions = [];

$this->removeIDFilterIfNeeded();

foreach ($this->filters() as $filter) {
$conditions[] = $filter->condition($params);
}
Expand Down Expand Up @@ -177,9 +189,7 @@ public function execute()
*/
public function render()
{
if (!$this->useIdFilter) {
array_shift($this->filters);
}
$this->removeIDFilterIfNeeded();

if (empty($this->filters)) {
return '';
Expand Down

0 comments on commit 3876eaf

Please sign in to comment.