Two column dropdown
Two column dropdown
There are no complete examples showing how to have one Select column that drives the data that will be shown in the next Select column. I have looked at the Unique() documentation, however, being new at this, I have no idea how to use it or where to even put it in the code. I can do this with php and SQL but with a lot more code, so I would prefer to use datatables editor, but I have spent days and days trying to figure it out with no luck. I've seen this question numerous times in the forum, however, no one has ever provided a complete answer or example of how to do it.
Answers
What you can do is use the
dependent()
method - attach that to the parentselect
and instruct it to make an Ajax request to the server to get the list of options when called (which you do simply by giving it the URL to make the Ajax request to):Then you need your script at the server-side (
/api/secondFieldOptions
in the above) to respond with JSON that will give the options for the second field:Regards,
Allan
Let me try this and get back to you. Thank you for your response.
Thank you for the response, however, my values would be coming from the database so, I still don't understand listing them as indicated. Since I'm new, would it just be better for me to pay for the support?
I could certainly put an example together for you under the support option if you like.
What do you have the server returning at the moment for the request to get the values?
Allan