@@ -810,9 +810,9 @@ $.fn.dropdown = function(parameters) {
810
810
values = [ ] ;
811
811
}
812
812
module . remove . message ( ) ;
813
- module . setup . menu ( {
814
- values : values
815
- } ) ;
813
+ var menuConfig = { } ;
814
+ menuConfig [ fields . values ] = values ;
815
+ module . setup . menu ( menuConfig ) ;
816
816
817
817
if ( values . length === 0 && ! settings . allowAdditions ) {
818
818
module . add . message ( message . noResults ) ;
@@ -1008,7 +1008,9 @@ $.fn.dropdown = function(parameters) {
1008
1008
module . clear ( ) ;
1009
1009
}
1010
1010
module . debug ( 'Creating dropdown with specified values' , values ) ;
1011
- module . setup . menu ( { values : values } ) ;
1011
+ var menuConfig = { } ;
1012
+ menuConfig [ fields . values ] = values ;
1013
+ module . setup . menu ( menuConfig ) ;
1012
1014
$ . each ( values , function ( index , item ) {
1013
1015
if ( item . selected == true ) {
1014
1016
module . debug ( 'Setting initial selection to' , item [ fields . value ] ) ;
@@ -1981,9 +1983,9 @@ $.fn.dropdown = function(parameters) {
1981
1983
selectValues : function ( ) {
1982
1984
var
1983
1985
select = { } ,
1984
- oldGroup = [ ]
1986
+ oldGroup = [ ] ,
1987
+ values = [ ]
1985
1988
;
1986
- select . values = [ ] ;
1987
1989
$module
1988
1990
. find ( 'option' )
1989
1991
. each ( function ( ) {
@@ -2004,14 +2006,14 @@ $.fn.dropdown = function(parameters) {
2004
2006
}
2005
2007
else {
2006
2008
if ( group . length !== oldGroup . length || group [ 0 ] !== oldGroup [ 0 ] ) {
2007
- select . values . push ( {
2009
+ values . push ( {
2008
2010
type : 'header' ,
2009
2011
divider : settings . headerDivider ,
2010
2012
name : group . attr ( 'label' ) || ''
2011
2013
} ) ;
2012
2014
oldGroup = group ;
2013
2015
}
2014
- select . values . push ( {
2016
+ values . push ( {
2015
2017
name : name ,
2016
2018
value : value ,
2017
2019
text : text ,
@@ -2026,19 +2028,21 @@ $.fn.dropdown = function(parameters) {
2026
2028
}
2027
2029
if ( settings . sortSelect ) {
2028
2030
if ( settings . sortSelect === true ) {
2029
- select . values . sort ( function ( a , b ) {
2031
+ values . sort ( function ( a , b ) {
2030
2032
return a . name . localeCompare ( b . name ) ;
2031
2033
} ) ;
2032
2034
} else if ( settings . sortSelect === 'natural' ) {
2033
- select . values . sort ( function ( a , b ) {
2035
+ values . sort ( function ( a , b ) {
2034
2036
return ( a . name . toLowerCase ( ) . localeCompare ( b . name . toLowerCase ( ) ) ) ;
2035
2037
} ) ;
2036
2038
} else if ( $ . isFunction ( settings . sortSelect ) ) {
2037
- select . values . sort ( settings . sortSelect ) ;
2039
+ values . sort ( settings . sortSelect ) ;
2038
2040
}
2041
+ select [ fields . values ] = values ;
2039
2042
module . debug ( 'Retrieved and sorted values from select' , select ) ;
2040
2043
}
2041
2044
else {
2045
+ select [ fields . values ] = values ;
2042
2046
module . debug ( 'Retrieved values from select' , select ) ;
2043
2047
}
2044
2048
return select ;
0 commit comments