datagrid date filter was not working with aliases is not fixed #392

This commit is contained in:
Prashant Singh 2018-12-22 18:07:45 +05:30
parent 232e430ab0
commit 3789587584
1 changed files with 18 additions and 7 deletions

View File

@ -567,7 +567,10 @@ class DataGrid
if ($this->aliased) { //aliasing is expected in this case or it will be changed to presence of join bag
foreach ($parsed as $key=>$value) {
if ($key=="sort") {
$column_name = $this->findAlias($key);
$column_type = $this->findType($key);
if ($key == "sort") {
//resolve the case with the column helper class
if(substr_count($key,'_') >= 1)
$column_name = $this->findAlias($key);
@ -603,18 +606,26 @@ class DataGrid
}
} else {
foreach ($value as $condition => $filter_value) {
$this->query->where(
$column_name,
$this->operators[$condition],
$filter_value
);
if($column_type == 'datetime') {
$this->query->whereDate(
$column_name,
$this->operators[$condition],
$filter_value
);
} else {
$this->query->where(
$column_name,
$this->operators[$condition],
$filter_value
);
}
}
}
}
}
} else {
//this is the case for the non aliasing.
foreach ($parsed as $key=>$value) {
foreach ($parsed as $key => $value) {
if ($key=="sort") {