Provide a JSON source for select field

Provide a JSON source for select field

sgiacintosgiacinto Posts: 3Questions: 0Answers: 0
edited October 2012 in Editor
Hello,
how can I provide a dynamic JSON source for a select field? I see the ipOpts object structure where I can statically define the options, however these options can change as they relate to another dataset. i.e: I enter a new mobile phone, and when I enter a new customer, I want to see that newly entered phone in the dropdown as a choice to assign to the new customer.

Maybe I am missing something in the documentation.

Our backend is PHP and we must use the existing classes for classic CRUD operation.
Any help is appreciated!

S.G.

Replies

  • allanallan Posts: 61,446Questions: 1Answers: 10,054 Site admin
    You can use the `update` method for the field. For example:

    [code]
    editor.field('dept.id').update( json.dept );
    [/code]

    This example shows how that can work in action:
    http://editor.datatables.net/release/DataTables/extras/Editor/examples/join.html

    Regards,
    Allan
  • sgiacintosgiacinto Posts: 3Questions: 0Answers: 0
    Thanks, that's got it!
This discussion has been closed.