Hello, looking to have the following.
In grid1 i have next settings:
$opt[“detail_grid_id”] = “list2”;
$opt[“subgridparams”] = “id,idserie”;
in grid2 have a column with:
$col = array();
$col[“title”] = “SubSerie”;
$col[“name”] = “idsubs”;
$col[“formatter”] = “select”;
$str2 = $grid2->get_dropdown_values(“select id as k, concat(clave,concat(‘-‘,descrip)) as v from subseries where client_id=”.$IDSERIE);
$col[“edittype”]=”select”; $col[“editoptions”] = array(“value” => $str2, “separator” => “:”, “delimiter” => “;”);
$cols2[] = $col;
obviously the use of $IDSERIE in the source of the dropdown list doesn’t work….
The idea is with “$IDSERIE” will can change dynamically the source of dropdown list based in a field of the grid1, Any ideas on how to do this?
Hi,
I could have explain better if I can see full code. However,
Most likely you will be using parent grid parameters in detail grid select. If you can select the idserie in select query, It can solve the issue.
$IDSERIE = $_GET["idserie"]; $grid2->select_command = "SELECT ...,idserie,... FROM tab WHERE condition";
Now when you have idserie available in select, you can create a column (hidden,non-editable,non-export) and just use it in onload-sql query with placeholder {idserie}
// removed where condition from this query. It will have all set.
$str2 = $grid2->get_dropdown_values("select id as k, concat(clave,concat('-',descrip)) as v from subseries"); $col["edittype"]="select"; $col["editoptions"] = array("value" => $str2, "separator" => ":", "delimiter" => ";");
// when editing, it will reload again with this query using placeholder.
$col["editoptions"]["onload"]["sql"] = "select id as k, concat(clave,concat('-',descrip)) as v from subseries where client_id = {idserie}";