Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7811537
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T04:12:03+00:00 2026-06-02T04:12:03+00:00

I am looping through rows in a list w/ $.each , and on each

  • 0

I am looping through rows in a list w/ $.each, and on each row applying a set of filters with $.each. I’d like to skip rows that do not match. It kinda looks like this:

$.each(data, function(i, row) {
    count      = parseInt(row['n']);
    year       = row['year'];

    if (options.filters) {
        $.each(options.filters, function(filter, filtervalue) {
            if (row[filter] != filtervalue) return true;
        });
    }

    // Will only get here if all filters have passed
}

How can I get the nested $.each loop to skip the row if filtervalue does not match a given filter?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T04:12:05+00:00Added an answer on June 2, 2026 at 4:12 am

    You want to skip a row if there is not at least one filter that filtervalue does not match, right? Then don’t skip a row iff the filtervalue matches at least one filter.

    $.each(data, function(i, row) {
        count      = parseInt(row['n']);
        year       = row['year'];
    
    
        // if there are no filters, don't skip the row (right? ;-)
        var skipRow = !!options.filters;
    
        if (options.filters) {
            $.each(options.filters, function(filter, filtervalue) {
                if (row[filter] == filtervalue) {
                    skipRow = false;
                }
            });
        }
    
        if (skipRow) return true;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently building a Gridview that has expandable rows. Each row contains a dynamically
I am looping through a large text file and im looking for lines that
I'm looping through an associative array with a foreach. I'd like to be able
I'm looping through multiple checkboxes with the same class with function each() and inside
I'm looping through the page controls like so foreach (Control ctrl in control.Controls) {
Say I'm looping through like 20/30 objects or in any other case where I'm
Having trouble looping through multiple rows in a SQL table and getting the info
I am looping through table rows in a table, but the first 1 or
Possible Duplicate: Looping through rows in a DataView I have created a dataview from
I've been requesting MySQL results and looping through them like this: $query = SELECT

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.