Editor select list with ajax list of values

Editor select list with ajax list of values

benathertonbenatherton Posts: 7Questions: 2Answers: 0

Hi,

Is it possible to have a select list (https://editor.datatables.net/reference/field/select) within the editor populate with a list of values from an AJAX source?

Does anyone have any example code for this?

Thanks in advance.

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 61,744Questions: 1Answers: 10,111 Site admin
    Answer ✓

    Yes, you can make the Ajax request to get the list of options and then use the update() method for the select field type (e.g. editor.field( 'mySelect' ).update( json );).

    Alternatively, if the options can be defined when the initial data set is loaded by DataTables, you can include an options parameter, which is used in this example. Documentation for that is available here.

    Allan

  • minion_warriorminion_warrior Posts: 7Questions: 1Answers: 0

    Where does the my select came form?

  • allanallan Posts: 61,744Questions: 1Answers: 10,111 Site admin

    That's the name of the field you want to change. See the field() documentation for details.

    Allan

This discussion has been closed.