Use PHP Variable to set Default Value for DefaultSearch Value

QuestionsUse PHP Variable to set Default Value for DefaultSearch Value
Thomas Hofmann asked 8 years ago

Hi together,

I want to set default search Parameters on initialiszing grid. I have tried a lot of posible ways, but nothing works. this is my source Code

// Default Value as a php variable
$defaultSuchbegriff = "bachmeier";
// Array to set the search values
$sarr = <<<'END'
{
"groupOp":"AND",
"rules":[
{"field":"suchbegriff","op":"cn","data":$defaultSuchbegriff},
{"field":"benutzername","op":"eq","data":"tom"}

]
}
END;

$grid["search"] = true;
$grid["postData"] = array("filters" => $sarr );

can anybody help me please.

Thank you very much

1 Answers
Abu Ghufran answered 8 years ago

You code looks fine. More you can do is to edit the demo code (demos/search/search-onload.php) and see the difference.
http://phpgrid.org/demo/demos/search/search-onload.phps

Your Answer

16 + 14 =

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 0 / 5. Vote count: 0

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?