dropdown edit not selected option

Questionsdropdown edit not selected option
Caroline asked 8 years ago

I have a problem with a dependent dropdown, below is the code I use to generate inside the grid the 2 components. Whenever I edit a record, item is selected but the list is the list of all client not the list of this client only.

And if I add this : $col["editoptions"]["onload"]["sql"] = "SELECT asso.id as k, nom as v FROM appelservice INNER JOIN asso_clients_equipements asso ON asso.id=appelservice.fk_id_asso_client_equip INNER JOIN ref_equipements ref ON ref.id=asso.fk_id_equipement WHERE appelservice.fk_id_client = '{fk_id_client}'";

The list is good for the client but the item is not selected.

Below is the code of the 2 dropdown's.

$col = array();
$col["title"] = "Client";
$col["name"] = "fk_id_client";
$col["dbname"] = "clients.nomcomplet";
$col["align"] = "left";
$col["search"] = true;
$col["editable"] = true;
$col["edittype"] = "select";
$str = $g->get_dropdown_values("SELECT id as k, CONCAT(nomcomplet, '-', adresse) as v FROM clients ORDER BY nomcomplet");
$col["editoptions"] = array(
"value"=>$str,
"onchange" => array( "sql"=>"SELECT asso.id as k, nom as v FROM asso_clients_equipements asso INNER JOIN ref_equipements ref ON ref.id=asso.fk_id_equipement WHERE fk_id_client = '{fk_id_client}'",
"update_field" => "fk_id_asso_client_equip")
);
$col["editoptions"]["dataInit"] = "function(){ setTimeout(function(){ link_select2('{$col["name"]}'); },200); }";
$col["formatter"] = "select";
$cols[] = $col;

$col = array();
$col["title"] = "Équipements";
$col["name"] = "fk_id_asso_client_equip";
$col["search"] = false;
$col["editable"] = true;
$col["edittype"] = "select";
$str = $g->get_dropdown_values("SELECT asso.id as k, nom as v FROM appelservice INNER JOIN asso_clients_equipements asso ON asso.id=appelservice.fk_id_asso_client_equip INNER JOIN ref_equipements ref ON ref.id=asso.fk_id_equipement");
$col["editoptions"] = array("value"=>$str);
$col["formatter"] = "select";
$cols[] = $col;

thanks!

1 Answers
Abu Ghufran answered 8 years ago

Hello,
I tested same scenario on demos/appearance/dropdown-dependent.php and unable to generate this issue.
Can you verify if this demo is working?

You can also send me grid code file and database sql dump to test here.
email me at [email protected]

Your Answer

11 + 11 =

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?