The subgridparams values aren't available in the subgrid

QuestionsThe subgridparams values aren't available in the subgrid
Massimo Gagliardi asked 10 years ago

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

2 Answers
Abu Ghufran answered 10 years ago

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.

Massimo Gagliardi answered 10 years ago

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

Your Answer

14 + 17 =

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?