Hi,
I try to add a data-attribute on my option tag on a ajax call but I can't.
processResults: function (data) {
return {
results: $.map(data, function (item) {
return {
text: item.text,
'data-tag': item.anotherValue,
id: item.id
};
})
};
},
If you're dealing with AJAX, you have full control over the data objects. So you don't need to include data- in front of things, the names will be included just like id and text normally are.
This appears to be more of a usage question than a bug report or common feature request. As we continue to keep the Select2 issue tracker geared towards these two areas, bug reports and common feature requests, we are redirecting usage questions to other communities such as the mailing list, IRC, or Stack Overflow.