File tree Expand file tree Collapse file tree 1 file changed +13
-5
lines changed Expand file tree Collapse file tree 1 file changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -51,14 +51,20 @@ $.fn.selectize = function(settings_user) {
5151 var optionsMap = { } ;
5252
5353 var readData = function ( $el ) {
54- var data = attr_data && $el . attr ( attr_data ) ;
54+ var data = attr_data && $el . attr ( attr_data ) ;
55+ var allData = $el . data ( ) ;
5556 var obj = { } ;
5657
57- if ( typeof data === 'string' && data . length && isJSON ( data ) ) {
58- return JSON . parse ( data ) ;
58+ if ( typeof data === 'string' && data . length ) {
59+ if ( isJSON ( data ) ) {
60+ Object . assign ( obj , JSON . parse ( data ) )
61+ } else {
62+ obj [ data ] = data ;
63+ }
5964 }
6065
61- obj [ data ] = data ;
66+
67+ Object . assign ( obj , allData ) ;
6268
6369 return obj || null ;
6470 } ;
@@ -91,7 +97,9 @@ $.fn.selectize = function(settings_user) {
9197 option [ field_label ] = option [ field_label ] || $option . text ( ) ;
9298 option [ field_value ] = option [ field_value ] || value ;
9399 option [ field_disabled ] = option [ field_disabled ] || $option . prop ( 'disabled' ) ;
94- option [ field_optgroup ] = option [ field_optgroup ] || group ;
100+ option [ field_optgroup ] = option [ field_optgroup ] || group ;
101+ option . styles = $option . attr ( 'style' ) || '' ;
102+ option . classes = $option . attr ( 'class' ) || '' ;
95103
96104 optionsMap [ value ] = option ;
97105 options . push ( option ) ;
You can’t perform that action at this time.
0 commit comments