• I have a follow up question to my support request you answered a few days ago.

    Now, I want to use the same filter parameters across two filters on a page with other alm instances that should not be filtered.

    My thought was to run the filter twice, changing the ID. I tried this js, but it’s adding the same results twice to the second instance:

    function filterAlm() {
        var toBeFiltered = $('.ajax-filtered');
        if( toBeFiltered.length === 0 ) {
          return true;
        }
        var data = new Object();
        data.taxonomy = [];
        data.taxonomyOperator = [];
        data.taxonomyTerms = [];
        $('.filter-group.has-selected').each( function() {
          $this = $(this);
          data.taxonomy.push($this.data('filter-tax'));
          data.taxonomyOperator.push('IN');
          var taxTerms = [];
          var activeFilters = $this.find('.dropdown-pane li.selected');
          $.each(activeFilters, function() {
            taxTerms.push($(this).data('tax-term'));
          });
          data.taxonomyTerms.push(taxTerms.join(', '));
          // console.log($this.data('filter-tax'));
        });
        var filterData = new Object();
        filterData.taxonomy = data.taxonomy.join(':');
        filterData.taxonomyOperator = data.taxonomyOperator.join(':');
        filterData.taxonomyTerms = data.taxonomyTerms.join(':');
        var transition = 'fade';
        var speed = '300';
        // console.log(filterData);
        $.each(toBeFiltered, function() {
          var ajaxID = $(this).parents('.ajax-load-more-wrap').data('id');
          console.log(ajaxID);
          filterData.target = ajaxID;
          $.fn.almFilter(transition, speed, filterData);
        });
        
      }

    Thoughts?

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Darren Cooney

    (@dcooney)

    You will only be able to filter a single instance (by id) or ALL instances of Ajax Load More.

    Thread Starter amddtim

    (@amddtim)

    Right, but can’t I filter one single instance and then another single instance right after the other? Do I need to wait for the first filter function to finish?

    Plugin Author Darren Cooney

    (@dcooney)

    Probably, but thats not one of my test cases so i’m not 100%.

    In the ALM filter function you could probably just call the filter again but then update the ID of the filter.

    Thread Starter amddtim

    (@amddtim)

    Well that’s what I thought my code was doing. Is there some promise I can use with the filter function, so I can execute something immediately after it’s been called and completed?

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Filtering x Instances on Page with x+y Instances’ is closed to new replies.