Default value in select

QuestionsDefault value in select
Mike Olson asked 2 years ago

Hi Abu, I know that the following will set a default filter, but how can I set the value of the drop select box on that column to match on load?

 

$sarr = <<< SEARCH_JSON
{
“groupOp”:”AND”,
“rules”:[
{“field”:”status”,”op”:”eq”,”data”:”Active”}
]
}
SEARCH_JSON;

3 Answers
Abu Ghufran Staff answered 2 years ago

You can set:

$col["searchoptions"] = array("defaultValue"=>'Active');
_________________________
Abu Ghufran - Dev Team
Grid 4 PHP Framework
 
Mike Olson answered 2 years ago

For some reason that doesn’t seem to work with:

 

//STATUS
$col = array();
$col[“title”] = “Status”; // caption of column, can use HTML tags too
$col[“name”] = “status”; // grid column name, same as db field or alias from sql
$col[“editable”] = false;
array(“list”=>true, “add”=>true, “edit”=>true, “view”=>true, “bulkedit”=>false);
$col[“stype”] = “select”;
$col[“searchoptions”] = array(“defaultValue”=>’Active’);
$col[“searchoptions”] = array(“value” => “:ALL;Inactive:Inactive;Active:Active;Terminated:Terminated”, “separator” => “:”, “delimiter” => “;”);
$cols[] = $col;

Mike Olson answered 2 years ago

Never mind, I see I needed to put it into my existing array

Your Answer

6 + 12 =

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?