Hi,
I have two tables:
Users (id, name)
TypeOfTask (id, iduser, nametask)
In dropdown A, I've the list of users.
In dropdown B, I want to show the tasks of the user that is selected in first dropdown.
The code:
https://pastebin.com/embed_js/d2Rt9ZT9
Adding a record, It works fine, when a user is selected, the dropdown B shows his tasks, but when I'm modifiying a register, dropdown B shows all the tasks.
Adding:
http://prntscr.com/euxgvp
Modifying:
http://prntscr.com/euxho1
Your code seems fine.Just swap these lines.
$col["editoptions"]["onload"]["sql"]="select tt_id as k, tt_descripcion as v from tipotareas where tt_idusuario='{t_idusuario}'";
$col["editoptions"] = array("value"=>":;".$str);
to
$col["editoptions"] = array("value"=>":;".$str);
$col["editoptions"]["onload"]["sql"]="select tt_id as k, tt_descripcion as v from tipotareas where tt_idusuario='{t_idusuario}'";
This line $col["editoptions"] = array("value"=>":;".$str); is basically resetting other line:
Hi!
It fails when two users have a task with the same name. Example:
User 1 have a type of task Description=Administration with IdTypeTask=4
User 2 have a type of task Description=Administration with IdTypeTask=25
If I modify an Administration Task of User 2, in the second dropdown "Administration" is not selected.
If I modify an Administration Task of User 1, in the second dropdown Administration it's selected correctly.
It seems like with two or more TypeTasks having the same description it works fine with the typetask with lower IdTypeTask (in this case 4).
If I change description of IdTypeTask=25 to "Administration2" it works fine for the two users.
Thanks
Hi,
Did the last solution helped? swapping lines for editoptions array,
$col["editoptions"] = array("value"=>":;".$str);
$col["editoptions"]["onload"]["sql"]="select tt_id as k, tt_descripcion as v from tipotareas where tt_idusuario='{t_idusuario}'";
Defining array first and then set onload-sql.
If issue still persist, you can send me complete code and database sql testing-dump at [email protected]
Hi!
I've send you an email with code and database. When two users have a task with the same name/description:
TASK_ID: 40
USER_ID: 16
DESCRIPTIONTASK: ADMINISTRACION
TASK_ID: 59
USER_ID: 18
DESCRIPTIONTASK: ADMINISTRACION
If I edit a task of type ADMINISTRACION of user 16 it works fine, but if I modify a task of type ADMINISTRACION of user 18 the dropdown don't select it. Changing descriptiontask of TASK_ID 59 to "ADMINISTRATION2", it works fine.
Thanks
Hello,
This ticket somehow remained unanswered.
Apologies for that.
We investigated this issue and currently it works this way.
The dropdown key / values must be unique in order to select properly. If same text have 2 ids, then it may perform unexpected.