Default value for dropdown search

QuestionsDefault value for dropdown search
Cedric asked 7 years ago

Hello Community,
I am trying to set up a column to have a dropdown filter.
The dropdown list display correctly, and filter fine when I select a value.
However the default value is select but the list is not filtered on the first load.
Here is my code:
$sqlstatus = "select distinct statuscode as k, $lang as v from modules_statuses where modname='HD'";
$col = array();
$col["title"] = "Status";
$col["name"] = "etat";
$col["width"] = "5";
$col["search"] = true;
$col["editable"] = true;
$col["edittype"] = "select"; // render as select
$str = $g->get_dropdown_values($sqlstatus);
$col["editoptions"] = array("value"=>$str);
$col["formatter"] = "select"; // display label, not value
$col["stype"] = "select"; // enable dropdown search
$col["searchoptions"] = array("value" => ":;".$str,"defaultValue"=>"0");
$cols[] = $col;

What I have missed??
Thanks,
Cedric

1 Answers
Cedric answered 7 years ago

Fixed:
forgot to add these:
$sarr = <<< SEARCH_JSON
{
"groupOp":"AND",
"rules":[
{"field":"etat","op":"lt","data":"6"}
]
}
SEARCH_JSON;

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

Your Answer

19 + 9 =

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?