I have a SharePoint list that contains multiple columns of information.

There’s a Category column that’s a look up to another list called ‘Category’. This is to produce unique ID’s for each of those values.

Originally, I wrote some jQuery that would filter items in the list (using a selection of checkboxes, Category 1 / Category 2 etc) based on the individual category. However, now I wish to filter items in the list based on an item that has multiple categories. This is where I’m stuck. The code below currently works for filtering items with just one category.

Both the filter and content are in separate Content Query Web Parts.


    <xsl:template name="list-items">
<div class="contact-container" SharePointID="{@ID}" Category="{@Category}" CategoryID="{@CategoryID}" Market="{@Market}" MarketID="{@MarketID}" href="#Popup-Container" >
    <a class="contact-items" href="#Popup-Container">
        <div class="title-container"><xsl:value-of select="@Title"/></div>



        if ( $('.checkbox:checked').size() == 0 ) {

            $('#item-container > .contact-container').show();

        } else {

            // We have just checked this checkbox 
            if ( $(this).is(":checked") ) {
                // This is the only checked checkbox (so hide everything)
                if ( $('.checkbox:checked').size() == 1 ) {
                    $('#item-container > .contact-container').hide();
            } else {
                // Hide all matching this filter as we just unchecked it 
                $('#item-container > .contact-container[categoryid="' + $(this).attr('CategoryID') + '"]').hide();

            // Only look at the items which have the matching category
            $('#item-container > .contact-container[categoryid="' + $(this).attr('CategoryID') + '"]').filter(function(index){
                if ( $('#category_' + $(this).attr('CategoryID') + ':checked').size() > 0 ||
                    $('#market_' + $(this).attr('MarketID') + ':checked').size() > 0) {
                    return true;
                return false;



Any help with this would be greatly appreciated.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.