selectpicker reset button not working properly

568
December 10, 2016, at 2:59 PM

I have a few drop down options, and a reset button connected to it all. The problem I'm having is when I select a few options in the dropdowns, and click reset, all of the other drop down menu's lose their values... I'm not too familiar with jquery/javascript etc but was hoping for some insight as to why the data gets lost only in this instance

    //-------------------
var changeEvent = 0;
var lastSeq = 0;
$scope.change = function(oldValue){
//    processed = [];
    changeEvent = 1;
    if( oldValue != null && oldValue.length==0 ){ /* we have an un-select */
        if( K.findAllSelected().size() == 0 ){
            $( '.selectpicker option' ).show();
            $( '.selectpicker' ).selectpicker( 'refresh' );
            changeEvent = 0;
        } else {
            changeEvent = 2;
        }
        console.log( " unselect " );
    }
    lastSeq = this.item_query;
    Query.setFirstSelection( lastSeq );
    Query.setSelectionText();
};
$('body').click(function(e) {
    if ( changeEvent===0 ||
        $(e.target).closest('.btn-group').length !== 0) {
        return;
    }
    var methDate = new Date();
    var currentVisible = K.getVisibleArray( lastSeq );
    K.hideAll();
    Query.reinventSelected( lastSeq, changeEvent );
    K.showSelected();
    K.showThisArraySeq( lastSeq, currentVisible );
    changeEvent = 0;
    Query.setSelectionText();
    $( '.selectpicker' ).selectpicker( 'refresh' );
    var endDate = new Date();
    console.log("change():" + (endDate - methDate)/1000 +" s");
});
$scope.reset = function(){
    $( '.selectpicker' ).selectpicker( 'deselectAll' );
    $( '.selectpicker' ).selectpicker( 'show' );
    $( '.selectpicker' ).selectpicker( 'refresh' );
    $( 'select[id^=query_select]' ).children().end().find( 'option' ).show();
    $( 'select[id^=query_select]' ).selectpicker( 'refresh' );
    $( '.input-daterange input' ).each(function() { $(this).datepicker("clearDates"); });
    $rootScope.$broadcast('sql', K.selectedFields());
    Query.setFirstSelection(0);
    Query.setSelectionText();
}
READ ALSO
JQuery Image Gallery - Selected Images Temporarily Changes Layout

JQuery Image Gallery - Selected Images Temporarily Changes Layout

I'm trying to create a simple Ecommerce product galleryWhenever the user clicks the thumbnail the images load correctly, but for a second the layout will shift positions because the image is swapping with the selected image

259
anchor link not working bootstrap jscript

anchor link not working bootstrap jscript

I used a jquery plugin for my site to design a vertical side menuThe logout anchor link in the top navigation bar and a testing link in the menu are not working

353
jQuery UI autocomplete links in Rails

jQuery UI autocomplete links in Rails

I have implement jQuery-ui autocomplete in my Rails app and it works fine, but i want also the results to be links to the products (eg

392