File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 18911891 postprocessResults : function ( ) {
18921892 var val = this . getVal ( ) ,
18931893 choices = this . results . find ( ".select2-result-selectable" ) ,
1894+ compound = this . results . find ( ".select2-result-with-children" ) ,
18941895 self = this ;
18951896
18961897 choices . each2 ( function ( i , choice ) {
18971898 var id = self . id ( choice . data ( "select2-data" ) ) ;
18981899 if ( indexOf ( id , val ) >= 0 ) {
1899- choice . addClass ( "select2-disabled" ) ;
1900+ choice . addClass ( "select2-disabled" ) . removeClass ( "select2-result-selectable" ) ;
19001901 } else {
1901- choice . removeClass ( "select2-disabled" ) ;
1902+ choice . removeClass ( "select2-disabled" ) . addClass ( "select2-result-selectable" ) ;
1903+ }
1904+ } ) ;
1905+
1906+ compound . each2 ( function ( i , e ) {
1907+ if ( e . find ( ".select2-result-selectable" ) . length == 0 ) {
1908+ e . addClass ( "select2-disabled" ) ;
1909+ } else {
1910+ e . removeClass ( "select2-disabled" ) ;
19021911 }
19031912 } ) ;
19041913
19051914 choices . each2 ( function ( i , choice ) {
1906- if ( ! choice . hasClass ( "select2-disabled" ) ) {
1907- self . highlight ( i ) ;
1915+ if ( ! choice . hasClass ( "select2-disabled" ) && choice . hasClass ( "select2-result-selectable" ) ) {
1916+ self . highlight ( 0 ) ;
19081917 return false ;
19091918 }
19101919 } ) ;
You can’t perform that action at this time.
0 commit comments