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