Select2 does not fill with values from table
Select2 does not fill with values from table
KimvdLinde
Posts: 30Questions: 8Answers: 0
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?
This discussion has been closed.
Answers
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
I send you a private e-mail with the info you need.
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.