Resolve the bugs left in filtering when join or without join aliasing is used
This commit is contained in:
parent
6e20306fbd
commit
636062c481
|
|
@ -71,11 +71,11 @@ class DataGridController extends Controller
|
|||
//Make case without any aliasing or joins
|
||||
DataGrid::make([
|
||||
'name' => 'admins',
|
||||
// 'select' => 'a.id',
|
||||
'table' => 'admins as a',
|
||||
'select' => 'a.id',
|
||||
'join' => [
|
||||
[
|
||||
'join' => 'leftjoin',
|
||||
'join' => 'rightjoin',
|
||||
'table' => 'roles as r',
|
||||
'primaryKey' => 'a.role_id',
|
||||
'condition' => '=',
|
||||
|
|
@ -97,17 +97,17 @@ class DataGridController extends Controller
|
|||
'sortable' => true,
|
||||
'filterable' => true,
|
||||
],
|
||||
[
|
||||
'name' => 'r.id',
|
||||
'type' => 'string',
|
||||
'label' => 'Role Table ID',
|
||||
'sortable' => true,
|
||||
'filterable' => true,
|
||||
],
|
||||
// [
|
||||
// 'name' => 'r.name',
|
||||
// 'type' => 'string',
|
||||
// 'label' => 'Role Table ID',
|
||||
// 'sortable' => true,
|
||||
// 'filterable' => true,
|
||||
// ],
|
||||
[
|
||||
'name' => 'r.name',
|
||||
'type' => 'string',
|
||||
'label' => 'Role Name',
|
||||
'label' => 'Admin Name',
|
||||
'sortable' => true,
|
||||
'filterable' => false,
|
||||
// will create on run time query
|
||||
|
|
|
|||
|
|
@ -318,11 +318,11 @@ class DataGrid
|
|||
//No kind of aliasing at all
|
||||
foreach ($this->columns as $column) {
|
||||
if ($column->filterable) { //condition is required managing params from users i.e url or request
|
||||
if ($columnFromRequest = $this->request->offsetGet($column->correctFilterSorting())) {
|
||||
if ($columnFromRequest = $this->request->offsetGet($column->correct())) {
|
||||
if ($filter = $columnFromRequest['filter']) {
|
||||
if ($condition = $columnFromRequest['condition']) {
|
||||
$this->query->where(
|
||||
$column->correctFilterSorting(),
|
||||
$column->correct(),
|
||||
$condition,
|
||||
$filter
|
||||
);
|
||||
|
|
|
|||
|
|
@ -12,8 +12,8 @@ class Column extends AbstractFillable
|
|||
private $request = null;
|
||||
private $readableName = false;
|
||||
private $value = false;
|
||||
// private $sortHtml = '<a href="%s">%s</a>';
|
||||
private $sortHtml = '<span href="%s">%s</span>';
|
||||
private $sortHtml = '<a href="%s">%s</a>';
|
||||
// private $sortHtml = '<span href="%s">%s</span>';
|
||||
|
||||
// protected $name;
|
||||
// protected $type;
|
||||
|
|
|
|||
Loading…
Reference in New Issue