Hi Abu
I am sure there is an easy answer but the solution eludes me. How do I automatically filter a dropdown list and limit the selection from within the PHP code. I have managed to set the correct default value but can’t filter away all the other selections in the dropdown list. Basically, I want the selection to be automatically made and limited to only one selection option.
define(“PROJECT_NUMBER”,”110902618″);
$col = array();
$col[“title”] = “ProjectNumber”;
$col[“name”] = “projectnumber”;
$col[“width”] = “100”;
$col[“editable”] = true;
$col[“search”] = true;
$col[“export”] = true;
$col[“align”] = “center”;
//$col[“frozen”] = true;
$col[“edittype”] = “lookup”;
$col[“editoptions”] = array(“defaultValue”=> PROJECT_NUMBER, “table”=>”tblprojectdetails”, “id”=>”projectnumber”, “label”=>”Projectnumber”);
$col[“editrules”] = array(“required”=>true); // and is required
////$col[“show”] = array(“edit”=>false); // only show freezed column in edit dialog
$cols[] = $col;
thanks you
Tony
Hi,
Instead of providing table,id,label properties, you can replace it with:
$str = $g->get_dropdown_values(“select projectnumber as k, projectnumber as v from tblprojectdetails where projectnumber = “.PROJECT_NUMBER);
$col[“editoptions”] = array(“value”=>”:;”.$str);
OR if you don’t want to perform database query and hardcode one value only, you can do:
$col[“editoptions”] = array(“value”=>PROJECT_NUMBER.”:”.PROJECT_NUMBER);
Pasting from docs:
Render as select (dropdown), with these values “key:value;key:value;key:value”
$col[“edittype”] = “select”;
$col[“editoptions”] = array(“value”=>’10:$10;20:$20;30:$30;40:$40;50:$50′);