summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzhixin <wenzhixin2010@gmail.com>2014-04-15 10:30:39 +0800
committerzhixin <wenzhixin2010@gmail.com>2014-04-15 10:30:39 +0800
commita09539a1e9926567c90a1b45beb6ab575d613779 (patch)
treed2bfcb436823d4b6a2965e5bc2d7f8833cca67de
parentf133eb5dde35beb695e27adb881746d9bc594597 (diff)
downloadmultiple-select-a09539a1e9926567c90a1b45beb6ab575d613779.zip
multiple-select-a09539a1e9926567c90a1b45beb6ab575d613779.tar.gz
multiple-select-a09539a1e9926567c90a1b45beb6ab575d613779.tar.bz2
Fix #42: Add styler option to custom item style.
-rw-r--r--jquery.multiple.select.js7
1 files changed, 5 insertions, 2 deletions
diff --git a/jquery.multiple.select.js b/jquery.multiple.select.js
index cd12a10..6e1f1a5 100644
--- a/jquery.multiple.select.js
+++ b/jquery.multiple.select.js
@@ -103,11 +103,12 @@
if ($elm.is('option')) {
var value = $elm.val(),
text = $elm.text(),
- selected = $elm.prop('selected');
+ selected = $elm.prop('selected'),
+ style = this.options.styler(value) ? ' style="' + this.options.styler(value) + '"' : '';
disabled = groupDisabled || $elm.prop('disabled');
html.push(
- '<li' + (multiple ? ' class="multiple"' : '') + '>',
+ '<li' + (multiple ? ' class="multiple"' : '') + style + '>',
'<label' + (disabled ? ' class="disabled"' : '') + '>',
'<input type="' + type + '" name="selectItem" value="' + value + '"' +
(selected ? ' checked="checked"' : '') +
@@ -437,6 +438,8 @@
container: null,
position: 'bottom', // 'bottom' or 'top'
+ styler: function() {return false;},
+
onOpen: function() {return false;},
onClose: function() {return false;},
onCheckAll: function() {return false;},