For get_dropdown_values, Is it possible to grab a value from the current row but a different column and implement WHERE to filter the possible values?
Example:
TABLE #1: task
Column: name, project_id, milestone_id
Data: my task, 3, 7
Table #2: milestone
Column: id, name, project_id
Data: 7, planning, 3
Data: 8, maintain, 4
Data: 9, evaluate, 3
When editing the row from Task, have a drop down for the milestone column to use the value “3” from the column “project_id”.
$str = $g->get_dropdown_values("select distinct id as k, name as v from milestone WHERE {project_id} ");
Which would execute: select distinct id as k, name as v from milestone WHERE project_id=3
And pull down to generate the value “planning” and “evaluate”
With that dropdown, you need to have following code:
$str = $g->get_dropdown_values("select distinct id as k, name as v from milestone");
$col[“editoptions”] = array(“value”=>$str);
$col[“editoptions”][“onload”][“sql”] = “select distinct id as k, name as v from milestone
WHERE project_id = {project_id}
“;
Removed where condition from get_dropdown() and added “onload-sql” option.