File tree Expand file tree Collapse file tree 2 files changed +33
-2
lines changed Expand file tree Collapse file tree 2 files changed +33
-2
lines changed Original file line number Diff line number Diff line change 77
77
$ ( 'select#speedA' ) . selectmenu ( 'disableByValue' , '11' ) ;
78
78
} ) ;
79
79
80
-
80
+ $ ( '#disableAll' ) . click ( function ( e ) {
81
+ e . preventDefault ( ) ;
82
+ $ ( 'select#speedA' ) . selectmenu ( 'disableAll' ) ;
83
+ } ) ;
84
+
85
+ $ ( '#enableAll' ) . click ( function ( e ) {
86
+ e . preventDefault ( ) ;
87
+ $ ( 'select#speedA' ) . selectmenu ( 'enableAll' ) ;
88
+ } ) ;
81
89
82
90
} ) ;
83
91
</ script >
96
104
< hr >
97
105
< a href ="#nogo " id ="disableSlow "> Disable "Slow" option</ a > < br >
98
106
< a href ="#nogo " id ="disable11 "> Disable "Up to eleven" option</ a > < br >
99
- < a href ="#nogo " id ="disableEverythingButSlow "> Disable everything but "Slow"</ a >
107
+ < a href ="#nogo " id ="disableEverythingButSlow "> Disable everything but "Slow"</ a > < br >
108
+ < a href ="#nogo " id ="disableAll "> Disable All</ a > < br >
109
+ < a href ="#nogo " id ="enableAll "> Enable All</ a >
110
+
100
111
101
112
< br />
102
113
< h2 > "default popup" Style</ h2 >
Original file line number Diff line number Diff line change @@ -827,6 +827,26 @@ $.widget("ui.selectmenu", {
827
827
return found ;
828
828
} ,
829
829
830
+ disableAll : function ( ) {
831
+ var self = this ;
832
+ this . element . find ( 'option' ) . each ( function ( i , opt ) {
833
+ if ( ! opt . disabled ) {
834
+ self . disable ( opt . index ) ;
835
+ }
836
+ } ) ;
837
+ this . disable ( ) ;
838
+ } ,
839
+
840
+ enableAll : function ( ) {
841
+ var self = this ;
842
+ if ( this . options . disabled ) {
843
+ this . enable ( ) ;
844
+ }
845
+ this . element . find ( 'option' ) . each ( function ( i , opt ) {
846
+ self . enable ( opt . index ) ;
847
+ } ) ;
848
+ } ,
849
+
830
850
disableByValue : function ( val ) {
831
851
var idx = this . indexByValue ( val ) ;
832
852
if ( idx !== null ) {
You can’t perform that action at this time.
0 commit comments