How to translate this into the Yii2 select2 kartik widget? I think the "data" attribute from the widget only allows for id -> text. Is this snipped of code possible using the widget?
var data = [{
id: 0,
text: 'enhancement',
html: '<div style="color:green">enhancement</div>'
}, {
id: 1,
text: 'bug',
html: '<div style="color:red">bug</div><div><small>This is some small text on a new line</small></div>'
}];
function template(data) {
return data.html;
}
$("select").select2({
data: data,
templateResult: template,
escapeMarkup: function(m) {
return m;
}
});
How to translate this into the Yii2 select2 kartik widget? I think the "data" attribute from the widget only allows for id -> text. Is this snipped of code possible using the widget?