grid data source as php array filter column(select) user_id by email

Questionsgrid data source as php array filter column(select) user_id by email
Milos asked 2 years ago

Hello im user of pro version

im using gridphp with mongo database, from mongo database i get php array and i set data source as php array all works fine except i cant filter column user_id by email ( by text search eg “n”) i can use drop down values but wish to have option to filter by part of the email as string. It seems that option is only feasible with real database connection.

 

$col = [];
 $col["title"] = "Client";
 $col["name"] = "user_id";
 $col["dbname"] = "email"; // this is required as we need to search in name field, not id
 $col["width"] = "100";
 $col["align"] = "left";
 $col["search"] = true;
 $col["editable"] = true;
 $col["export"] = false; // not for export
 $col["edittype"] = "select"; // render as select

 $col["editoptions"]=[
     "value" => ":;".implode(";",$users_list),
     "separator" => ":",
     "delimiter" => ";",
     "defaultValue"=>""
 ];
 $col["searchoptions"]=[
     "value" => ":;".implode(";",$users_list),
     "separator" => ":",
     "delimiter" => ";",
     "defaultValue"=>""
 ];
// $col["editrules"] = array("required"=>true);
 $col["formatter"] = "select"; // display label, not value
 $cols[] = $col;

...
$g->table = $data; // blank array(); will show no records

//data array has items

$data=[];
$data[]=[“user_id”=>1,”email’:”[email protected]”]

Non working with text search

View post on imgur.com

Working with select dropdown

View post on imgur.com

 

2 Answers
milos answered 2 years ago

I forget to wrote that $user_list[]=\\\”1:[email protected]] kas key:value shema as requested

Abu Ghufran Staff answered 2 years ago

If you don’t wish to use select dropdown in filter, you can change the key:value pair to use as email:email instead of id:email.

Change 1:[email protected] to [email protected]:[email protected]. This will enable text searching.

_________________________
Abu Ghufran - Dev Team
Grid 4 PHP Framework
 
Your Answer

6 + 15 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating 5 / 5. Vote count: 1

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?