Editor dropdown box with composed field
Editor dropdown box with composed field
fabioberetta
Posts: 74Questions: 23Answers: 4
in Editor
Dear all,
I am trying to set up an editor that allows to have a selector (dropdown menu) like in this example.
http://editor.datatables.net/examples/plug-ins/fieldPlugin.html
In the "options" of the dropdows I need to put a combination of 2 fields (first_name + last_name) coming from the database.
I do not find any simple example on how to do it. Can you help?
ty
f
This question has accepted answers - jump to:
This discussion has been closed.
Answers
If that select is supposed to update the data, how would you parse the selected option to apply it to separate fields?
Hi,
How are you currently populating the list of options? Are you using the
Field->options()
method? If so, what you would need to do is provide a closure function that performs the concatenation that you are looking for. There is an example of that available here - click the "Server script" tab below the table and have a look at lines 27-42.Presumably this is just the label and not the value so only output formatting is required.
Allan
Hi Allan,
thanks, this is exactly what I needed.
One more thing. How do I set the where clause?
This comes from your example:
I have to filter the table with a clause like account_id = $_SESSION['account_id']. How should I set the where clause?
ty
f
The
Database->selectDistinct()
method allows an optionwhere
array to be passed in. So you might use:Allan
And it worked perfectly!
Thanks,
f