11/**
2- * @lordfriend /nya-bootstrap-select v2.4 .0
2+ * @lordfriend /nya-bootstrap-select v2.5 .0
33 * Copyright 2014 Nyasoft
44 * Licensed under MIT license
55 */
@@ -752,6 +752,28 @@ nyaBsSelect.directive('nyaBsSelect', ['$parse', '$document', '$timeout', '$compi
752752 } ;
753753 $document . on ( 'click' , outClick ) ;
754754
755+ function reset_search ( ) {
756+ searchBox . children ( ) . eq ( 0 ) [ 0 ] . value = "" ;
757+ var options = dropdownMenu . children ( ) ,
758+ length = options . length ,
759+ index ,
760+ option ,
761+ nyaBsOptionNode ;
762+ for ( index = 0 ; index < length ; index ++ ) {
763+ option = options . eq ( index ) ;
764+ if ( option . hasClass ( 'nya-bs-option' ) ) {
765+ option . removeClass ( 'not-match' ) ;
766+ }
767+ }
768+ noSearchResult . removeClass ( 'show' ) ;
769+ nyaBsOptionNode = findFocus ( true ) ;
770+
771+ if ( nyaBsOptionNode ) {
772+ options . removeClass ( 'active' ) ;
773+ jqLite ( nyaBsOptionNode ) . addClass ( 'active' ) ;
774+ }
775+ }
776+
755777
756778
757779 dropdownToggle . on ( 'blur' , function ( ) {
@@ -766,6 +788,7 @@ nyaBsSelect.directive('nyaBsSelect', ['$parse', '$document', '$timeout', '$compi
766788 calcMenuSize ( ) ;
767789 }
768790 if ( $attrs . liveSearch === 'true' && $element . hasClass ( 'open' ) ) {
791+ reset_search ( ) ;
769792 searchBox . children ( ) . eq ( 0 ) [ 0 ] . focus ( ) ;
770793 nyaBsOptionNode = findFocus ( true ) ;
771794 if ( nyaBsOptionNode ) {
0 commit comments