I have a first grid with:
…
$col = array();
$col["title"] = "Provider";
$col["name"] = "IDProvider";
…
$col = array();
$col["title"] = "Subcustomer";
$col["name"] = "IDSubcustomer";
…
I declare the subgrids and the parameters:
…
$grid["detail_grid_id"] = "list2,list3,list4";
$grid["subgridparams"] = "IDInvoice,IDProvider,IDSubcustomer";
…
In the 4th subgrid I recovery the parameters:
…
$IDProvider = intval($_GET["IDProvider"]);
$IDSubcustomer = intval($_GET["IDSubcustomer "]);
…
Finally I use the parameters:
…
$col["title"] = "Article";
$col["name"] = "IDArticle";
$col["dbname"] = "hmr_own_articles.Description";
$col["editable"] = true;
$col["edittype"] = "select";
$str = $g->get_dropdown_values("SELECT DISTINCT IDArticle AS k, Description AS v FROM hmr_own_articles ORDER BY Description");
$col["editoptions"] = array("value"=>":;".$str);
$col["editoptions"]["onload"]["sql"] = "SELECT DISTINCT IDArticle AS k, Description AS v FROM hmr_own_articles WHERE IDProvider = " . $IDProvider . " AND IDSubcustomer = " . $IDSubcustomer . " ORDER BY Description";
…
But don't work.
The debug shows that $IDProvider and $IDSubcustomer have 0 value.
Where is the error?
Thanks to all aids
Perhaps, intval() is causing it to be zero.
If the data is non-integer it is converted to zero.
Otherwise, variables should be available at this place.
Thanks Abu to remind me the scope of intval().
In effect I have, in the master grid, this definition (in my initial ticket I have summarized):
…
$col = array();
$col["title"] = "Provider";
$col["name"] = "IDProvider";
$col["dbname"] = "hmr_own_clienti_fornitori.RagioneSociale";
$col["width"] = "16";
$col["editable"] = true;
$col["edittype"] = "select";
$col["editrules"] = array("required"=>true);
$str = $g->get_dropdown_values("SELECT DISTINCT IDProvider AS k, RagioneSociale AS v FROM hmr_own_clienti_fornitori");
…
this definition doesn't return an integer but a text !!
Thanks