Select2 does not fill with values from table

Select2 does not fill with values from table

KimvdLindeKimvdLinde Posts: 30Questions: 8Answers: 0
edited February 2017 in Editor

Okay, I have successfully implemented select2, except one thing. I do not seem to be able to figure out how to have the values already in datatables to show up in the editor as existing values when I use the multiselect tags.

In the table initiation, I have:

{
    title:      "Recipient(s)",
    name:       "recipients",
    data:       'recipients',
    orderable:  false,
    className:  "alignCenter displayOrder",
    render:     function(data, type, full, meta){
        return getRecipients(full.recipients);
    }
},

And in the editor for the same field I have:

{
      label:        "Individual recipient(s)",
      name:     "recipients",
      type:     "select2",
      opts: {
                multiple: true,
                placeholder: 'Select one or more recipients',
        minimumInputLength: 3,
        ajax:{
                url: "index.cfm?fuseaction=admin.recipientSearch",
            dataType: 'json',
                delay: 250,
            data: function (params) {
                  return {q: params.term};
                },
            processResults: function (data, params) {
                  return {results: data.results};
               },
               cache: true
        }
        }
},

What am I missing?

Answers

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    Could you possibly link to the page so I can take a look and attempt to debug it with the data please? For example, what is the value of recipients?

    Allan

  • KimvdLindeKimvdLinde Posts: 30Questions: 8Answers: 0

    I send you a private e-mail with the info you need.

  • KimvdLindeKimvdLinde Posts: 30Questions: 8Answers: 0

    For now, I use a workaround by picking up the list of recipients that have already been added to records and add them to the javascript code as options.

This discussion has been closed.