Keep select option's original style, too.
This commit is contained in:
parent
7dd29088e8
commit
d87310ee5d
7 changed files with 19 additions and 10 deletions
|
@ -290,7 +290,7 @@
|
|||
}
|
||||
};
|
||||
Chosen.prototype.result_add_option = function(option) {
|
||||
var classes;
|
||||
var classes, style;
|
||||
if (!option.disabled) {
|
||||
option.dom_id = this.container_id + "_o_" + option.array_index;
|
||||
classes = option.selected && this.is_multiple ? [] : ["active-result"];
|
||||
|
@ -303,7 +303,8 @@
|
|||
if (option.classes !== "") {
|
||||
classes.push(option.classes);
|
||||
}
|
||||
return '<li id="' + option.dom_id + '" class="' + classes.join(' ') + '">' + option.html + '</li>';
|
||||
style = option.style.cssText !== "" ? " style=\"" + option.style + "\"" : "";
|
||||
return '<li id="' + option.dom_id + '" class="' + classes.join(' ') + '"' + style + '>' + option.html + '</li>';
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
|
@ -823,7 +824,8 @@
|
|||
selected: option.selected,
|
||||
disabled: group_disabled === true ? group_disabled : option.disabled,
|
||||
group_array_index: group_position,
|
||||
classes: option.className
|
||||
classes: option.className,
|
||||
style: option.style.cssText
|
||||
});
|
||||
} else {
|
||||
this.parsed.push({
|
||||
|
|
2
chosen/chosen.jquery.min.js
vendored
2
chosen/chosen.jquery.min.js
vendored
File diff suppressed because one or more lines are too long
|
@ -278,7 +278,7 @@
|
|||
}
|
||||
};
|
||||
Chosen.prototype.result_add_option = function(option) {
|
||||
var classes;
|
||||
var classes, style;
|
||||
if (!option.disabled) {
|
||||
option.dom_id = this.container_id + "_o_" + option.array_index;
|
||||
classes = option.selected && this.is_multiple ? [] : ["active-result"];
|
||||
|
@ -291,7 +291,8 @@
|
|||
if (option.classes !== "") {
|
||||
classes.push(option.classes);
|
||||
}
|
||||
return '<li id="' + option.dom_id + '" class="' + classes.join(' ') + '">' + option.html + '</li>';
|
||||
style = option.style.cssText !== "" ? " style=\"" + option.style + "\"" : "";
|
||||
return '<li id="' + option.dom_id + '" class="' + classes.join(' ') + '"' + style + '>' + option.html + '</li>';
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
|
@ -812,7 +813,8 @@
|
|||
selected: option.selected,
|
||||
disabled: group_disabled === true ? group_disabled : option.disabled,
|
||||
group_array_index: group_position,
|
||||
classes: option.className
|
||||
classes: option.className,
|
||||
style: option.style.cssText
|
||||
});
|
||||
} else {
|
||||
this.parsed.push({
|
||||
|
|
2
chosen/chosen.proto.min.js
vendored
2
chosen/chosen.proto.min.js
vendored
File diff suppressed because one or more lines are too long
|
@ -238,7 +238,9 @@ class Chosen
|
|||
classes.push "group-option" if option.group_array_index?
|
||||
classes.push option.classes if option.classes != ""
|
||||
|
||||
'<li id="' + option.dom_id + '" class="' + classes.join(' ') + '">' + option.html + '</li>'
|
||||
style = if option.style.cssText != "" then " style=\"#{option.style}\"" else ""
|
||||
|
||||
'<li id="' + option.dom_id + '" class="' + classes.join(' ') + '"'+style+'>' + option.html + '</li>'
|
||||
else
|
||||
""
|
||||
|
||||
|
|
|
@ -232,7 +232,9 @@ class Chosen
|
|||
classes.push "group-option" if option.group_array_index?
|
||||
classes.push option.classes if option.classes != ""
|
||||
|
||||
'<li id="' + option.dom_id + '" class="' + classes.join(' ') + '">' + option.html + '</li>'
|
||||
style = if option.style.cssText != "" then " style=\"#{option.style}\"" else ""
|
||||
|
||||
'<li id="' + option.dom_id + '" class="' + classes.join(' ') + '"'+style+'>' + option.html + '</li>'
|
||||
else
|
||||
""
|
||||
|
||||
|
|
|
@ -35,6 +35,7 @@ class SelectParser
|
|||
disabled: if group_disabled is true then group_disabled else option.disabled
|
||||
group_array_index: group_position
|
||||
classes: option.className
|
||||
style: option.style.cssText
|
||||
else
|
||||
@parsed.push
|
||||
array_index: @parsed.length
|
||||
|
|
Loading…
Add table
Reference in a new issue