File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -964,6 +964,13 @@ the specific language governing permissions and limitations under the Apache Lic
964964 }
965965 } ,
966966
967+ // abstract
968+ triggerSelect : function ( data ) {
969+ var evt = $ . Event ( "selected" , { val : this . id ( data ) , object : data } ) ;
970+ this . opts . element . trigger ( evt ) ;
971+ return ! evt . isDefaultPrevented ( ) ;
972+ } ,
973+
967974 /**
968975 * Triggers the change event on the source element
969976 */
@@ -1974,6 +1981,9 @@ the specific language governing permissions and limitations under the Apache Lic
19741981
19751982 // single
19761983 onSelect : function ( data , options ) {
1984+
1985+ if ( ! this . triggerSelect ( data ) ) { return ; }
1986+
19771987 var old = this . opts . element . val ( ) ,
19781988 oldData = this . data ( ) ;
19791989
@@ -2407,6 +2417,9 @@ the specific language governing permissions and limitations under the Apache Lic
24072417
24082418 // multi
24092419 onSelect : function ( data , options ) {
2420+
2421+ if ( ! this . triggerSelect ( data ) ) { return ; }
2422+
24102423 this . addSelectedChoice ( data ) ;
24112424
24122425 this . opts . element . trigger ( { type : "selected" , val : this . id ( data ) , choice : data } ) ;
You can’t perform that action at this time.
0 commit comments