Datagrid filters bug fix due to return statement used it was working on only first filter only
This commit is contained in:
parent
89ec9b5a9e
commit
30a2031867
|
|
@ -174,13 +174,13 @@ abstract class DataGrid
|
|||
if (array_keys($info)[0] == "like" || array_keys($info)[0] == "nlike") {
|
||||
foreach ($info as $condition => $filter_value) {
|
||||
if ($this->enableFilterMap && isset($this->filterMap[$columnName])) {
|
||||
return $collection->where(
|
||||
$collection->where(
|
||||
$this->filterMap[$columnName],
|
||||
config("datagrid.operators.{$condition}"),
|
||||
'%'.$filter_value.'%'
|
||||
);
|
||||
} else {
|
||||
return $collection->where(
|
||||
$collection->where(
|
||||
$columnName,
|
||||
config("datagrid.operators.{$condition}"),
|
||||
'%'.$filter_value.'%'
|
||||
|
|
@ -191,13 +191,13 @@ abstract class DataGrid
|
|||
foreach ($info as $condition => $filter_value) {
|
||||
if ($columnType == 'datetime') {
|
||||
if ($this->enableFilterMap && isset($this->filterMap[$columnName])) {
|
||||
return $collection->whereDate(
|
||||
$this->filterMap[$columnname],
|
||||
$collection->whereDate(
|
||||
$this->filterMap[$columnName],
|
||||
config("datagrid.operators.{$condition}"),
|
||||
$filter_value
|
||||
);
|
||||
} else {
|
||||
return $collection->whereDate(
|
||||
$collection->whereDate(
|
||||
$columnName,
|
||||
config("datagrid.operators.{$condition}"),
|
||||
$filter_value
|
||||
|
|
@ -205,13 +205,13 @@ abstract class DataGrid
|
|||
}
|
||||
} else {
|
||||
if ($this->enableFilterMap && isset($this->filterMap[$columnName])) {
|
||||
return $collection->where(
|
||||
$collection->where(
|
||||
$this->filterMap[$columnName],
|
||||
config("datagrid.operators.{$condition}"),
|
||||
$filter_value
|
||||
);
|
||||
} else {
|
||||
return $collection->where(
|
||||
$collection->where(
|
||||
$columnName,
|
||||
config("datagrid.operators.{$condition}"),
|
||||
$filter_value
|
||||
|
|
@ -222,6 +222,8 @@ abstract class DataGrid
|
|||
}
|
||||
}
|
||||
}
|
||||
dd($collection->toSql());
|
||||
return $collection;
|
||||
}
|
||||
|
||||
public function prepareMassActions() {
|
||||
|
|
|
|||
|
|
@ -440,6 +440,12 @@
|
|||
filterRepeated = 1;
|
||||
|
||||
return false;
|
||||
} else if(this.filters[j].cond == condition && this.filters[j].val != response) {
|
||||
filterRepeated = 1;
|
||||
|
||||
this.filters[j].val = response;
|
||||
|
||||
this.makeURL();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue