Populate Option list in Editor Form
Populate Option list in Editor Form
mm789000
Posts: 25Questions: 2Answers: 0
in DataTables
Hi,
I want to populate an option list in Editor form with a query base on row data field.
How can i do ?
Regards
Link to test case:
Debugger code (debug.datatables.net):
Error messages shown:
Description of problem:
Replies
Just to confirm my understanding - you want to change the options of a
select
input based on another value in the row? Thedependent()
method will help you with that. Have a look at this blog post which discusses this sort of thing.Allan
Just read the options from the server using a suitable event handler. I would use the "init" event handler: At that time you will have your row data available.
Then on "open" of your Editor you can populate the options of your field using
this: https://editor.datatables.net/reference/api/field().update()
Alternatively you can read the options only when opening the Editor. Here is an example from my coding. It doesn't use "field().update()" because that doesn't work with a selectize field. Hence I clear the field and reinsert it into Editor with the options loaded from the server.
Thanks !