Skip to content

Commit

Permalink
Fix: add style and class attributes to option template
Browse files Browse the repository at this point in the history
  • Loading branch information
fabienwnklr committed Oct 6, 2022
1 parent c9ed4e8 commit 0dfc14d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/selectize.js
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,11 @@ $.extend(Selectize.prototype, {
return '<div class="optgroup-header">' + escape(data[field_optgroup]) + '</div>';
},
'option': function(data, escape) {
return '<div class="option '+( data[field_value] === '' ? 'selectize-dropdown-emptyoptionlabel' : '')+'">' + escape(data[field_label]) + '</div>';
var classes = data.classes ? ' ' + data.classes : '';
classes = data[field_value] === '' ? ' selectize-dropdown-emptyoptionlabel' : '';

var styles = data.styles ? ' style="' + data.styles + '"': '';
return '<div' + styles + ' class="option' + classes + '">' + escape(data[field_label]) + '</div>';
},
'item': function(data, escape) {
return '<div class="item">' + escape(data[field_label]) + '</div>';
Expand Down

0 comments on commit 0dfc14d

Please sign in to comment.