function updateFacetUI() {
        var itemtemplate = _.template(settings.listItemTemplate);
        _.each(settings.facetStore, function (facet, facetname) {
            _.each(facet, function (filter, filtername) {
                var item = {id: filter.id, name: filtername, count: filter.count};
                var filteritem = $(itemtemplate(item)).html();
                $("#" + filter.id).html(filteritem);
                if (settings.state.filters[facetname] && _.indexOf(settings.state.filters[facetname], filtername) >= 0) {
                    $("#" + filter.id).addClass("activefacet");
                } else {
                    $("#" + filter.id).removeClass("activefacet");
                }
            });
        });

        var countCompile = _.template(settings.countTemplate);
        var countHTML = countCompile({count: settings.currentResults.length});
        $(settings.facetSelector + ' .facettotalcount').replaceWith(countHTML);
    }
/**
     * This function is only called whenever a filter has been added or removed
     * It adds a class to the active filters and shows the correct number for each
     */
This function is only called whenever a filter has been added or removed
It adds a class to the active filters and shows the correct number for each
This function is only called whenever a filter has been added or removed It adds a class to the active filters and shows the correct number for each
function updateFacetUI() {
        var itemtemplate = _.template(settings.listItemTemplate);
        _.each(settings.facetStore, function (facet, facetname) {
            _.each(facet, function (filter, filtername) {
                var item = {id: filter.id, name: filtername, count: filter.count};
                var filteritem = $(itemtemplate(item)).html();
                $("#" + filter.id).html(filteritem);
                if (settings.state.filters[facetname] && _.indexOf(settings.state.filters[facetname], filtername) >= 0) {
                    $("#" + filter.id).addClass("activefacet");
                } else {
                    $("#" + filter.id).removeClass("activefacet");
                }
            });
        });
        var countCompile = _.template(settings.countTemplate);
        var countHTML = countCompile({count: settings.currentResults.length});
        $(settings.facetSelector + ' .facettotalcount').replaceWith(countHTML);
    }
function updateFacetUI ( ) { var itemtemplate = _ . template ( settings . listItemTemplate ) ; _ . each ( settings . facetStore , function ( facet , facetname ) { _ . each ( facet , function ( filter , filtername ) { var item = { id : filter . id , name : filtername , count : filter . count } ; var filteritem = $ ( itemtemplate ( item ) ) . html ( ) ; $ ( "#" + filter . id ) . html ( filteritem ) ; if ( settings . state . filters [ facetname ] && _ . indexOf ( settings . state . filters [ facetname ] , filtername ) >= 0 ) { $ ( "#" + filter . id ) . addClass ( "activefacet" ) ; } else { $ ( "#" + filter . id ) . removeClass ( "activefacet" ) ; } } ) ; } ) ; var countCompile = _ . template ( settings . countTemplate ) ; var countHTML = countCompile ( { count : settings . currentResults . length } ) ; $ ( settings . facetSelector + ' .facettotalcount' ) . replaceWith ( countHTML ) ; }
This function is only called whenever a filter has been added or removed
 It adds a class to the active filters and shows the correct number for each
This function is only called whenever a filter has been added or removed It adds a class to the active filters and shows the correct number for each