Commit 9cccf38a authored by Piotr Romanowski's avatar Piotr Romanowski

Added ability to add css class to data provider options.

You can now add a class option to a node of the data provider options and it will be appended to the list item.
parent 6367ced0
......@@ -252,6 +252,11 @@
optionLabel: function(element){
return $(element).attr('label') || $(element).text();
},
optionClass: function(element) {
return $(element).attr('class') || '';
},
/**
* Triggered on change of the multiselect.
*
......@@ -675,12 +680,14 @@
// Support the label attribute on options.
var label = this.options.optionLabel(element);
var classes = this.options.optionClass(element);
var value = $element.val();
var inputType = this.options.multiple ? "checkbox" : "radio";
var $li = $(this.options.templates.li);
var $label = $('label', $li);
$label.addClass(inputType);
$li.addClass(classes);
if (this.options.enableHTML) {
$label.html(" " + label);
......@@ -1220,6 +1227,7 @@
value: option.value,
label: option.label || option.value,
title: option.title,
class: option.class,
selected: !!option.selected,
disabled: !!option.disabled
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment