src/jquery.azuresearch.js
//Default action when a facet is selected
Default action when a facet is selected
Default action when a facet is selected
function defaultFacetSelect() {
        var sfs = ls.facetsApplied;
        if (!sfs.container)
            return;
        var lastFacet = this.pop();
        var c = $(sfs.container);
        var fs = lastFacet.split('|');
        if (sfs.ignoreFacets.indexOf(fs[0]) != -1)
            return;
        if( c.find('.selected-facets-group[data-az-field="'+fs[0]+'"]').length > 0 ) {            
            cc = c.find('.selected-facets-group[data-az-field="'+fs[0]+'"]');
        } else {                        
            cc = $('<div/>').addClass('selected-facets-group').attr('data-az-field',fs[0]).appendTo(c);
            cc_title = ls.facetsDictionary && ls.facetsDictionary[fs[0]] ? ls.facetsDictionary[fs[0]] : v;
            cc_titleElem = $('<span/>').addClass('selected-facets-group-title').text(cc_title).appendTo(cc);
        }    
        var selectedFacet = $('<a/>').text(fs[1])
            .attr({ 'href': '#' })
            .attr(sfs.extraAttributes)
            .data('value', lastFacet)
            .addClass(sfs.class)
            .on('click', function () {
                ls.facetsSelected
                    .splice(
                        ls.facetsSelected.indexOf($(this).data('value')), 1
                    );
                ls.facetsApplied.onChange.call(ls.facetsSelected.slice(0));
                if($(this).parent('.selected-facets-group[data-az-field="'+fs[0]+'"]').children('.selected-facet').length <= 1) {
                    $(this).parent('.selected-facets-group[data-az-field="'+fs[0]+'"]').remove();
                } else {
                    $(this).remove();
                }
                search();
            })
            selectedFacet.appendTo(cc);
    }
function defaultFacetSelect ( ) { var sfs = ls . facetsApplied ; if ( ! sfs . container ) return ; var lastFacet = this . pop ( ) ; var c = $ ( sfs . container ) ; var fs = lastFacet . split ( '|' ) ; if ( sfs . ignoreFacets . indexOf ( fs [ 0 ] ) != - 1 ) return ; if ( c . find ( '.selected-facets-group[data-az-field="' + fs [ 0 ] + '"]' ) . length > 0 ) { cc = c . find ( '.selected-facets-group[data-az-field="' + fs [ 0 ] + '"]' ) ; } else { cc = $ ( '<div/>' ) . addClass ( 'selected-facets-group' ) . attr ( 'data-az-field' , fs [ 0 ] ) . appendTo ( c ) ; cc_title = ls . facetsDictionary && ls . facetsDictionary [ fs [ 0 ] ] ? ls . facetsDictionary [ fs [ 0 ] ] : v ; cc_titleElem = $ ( '<span/>' ) . addClass ( 'selected-facets-group-title' ) . text ( cc_title ) . appendTo ( cc ) ; } var selectedFacet = $ ( '<a/>' ) . text ( fs [ 1 ] ) . attr ( { 'href' : '#' } ) . attr ( sfs . extraAttributes ) . data ( 'value' , lastFacet ) . addClass ( sfs . class ) . on ( 'click' , function ( ) { ls . facetsSelected . splice ( ls . facetsSelected . indexOf ( $ ( this ) . data ( 'value' ) ) , 1 ) ; ls . facetsApplied . onChange . call ( ls . facetsSelected . slice ( 0 ) ) ; if ( $ ( this ) . parent ( '.selected-facets-group[data-az-field="' + fs [ 0 ] + '"]' ) . children ( '.selected-facet' ) . length <= 1 ) { $ ( this ) . parent ( '.selected-facets-group[data-az-field="' + fs [ 0 ] + '"]' ) . remove ( ) ; } else { $ ( this ) . remove ( ) ; } search ( ) ; } ) selectedFacet . appendTo ( cc ) ; }
Default action when a facet is selected
Default action when a facet is selected
//Ignore if necessary // check if any facets exist other than this one