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 3606056
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T21:12:03+00:00 2026-05-18T21:12:03+00:00

I am developing a javascript filtering of some results and have some difficulties.. Here

  • 0

I am developing a javascript filtering of some results and have some difficulties..
Here is the problem…
Suppose that we have some criteria

  1. Manufacter (Trusardi, Calvin Kein, Armani…)
  2. Color (red, blue, black…)
  3. OtherFeatures (goretex, blah, blah…)

Each feature is displayed as a checkbox…
The problem is that i want to disable the checkboxes if its selection would lead to no results..For example Armani’s products may have color blue only so checking armani should disable the black and red,but other manufactors shouldnt be disabled… as checking them should provide a result…
Here is the code so far

results = $("#products li");
results.hide();
var filtersGroup = $("#filters li.filtersGroup");

$("#filters li.filtersGroup a").removeClass("disabled");
filtersGroup.each(function(index) {
    var classes = "";

    $(this).find("a.checked").each(function(index) {
        classes = classes + "." + $(this).attr("id") + ",";
    });
    if (classes == "") return true;

    results = results.filter(classes.substr(0, classes.length - 1));
    //periorismos
    filtersGroup.not($(this)).each(function(index) {
        $(this).find("a").each(function(index) {
            if (results.filter("." + $(this).attr("id")).length <= 0) {
                $(this).removeClass("checked").addClass("disabled");
            }
        });
    });
});

Although it filters them successfully ,the disabling isnt always correct. for example to reproduce the problem ,if you choose all the manufactors and then choose a color manufactors would be disabled but colors not at the first time..
One solution i figured is to create multiple results which would simulate all the next possible check.(if 16 features and 4 checked means 12 possible other checked ..
But i think that this approach sucks… Any other idea?

  • 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-05-18T21:12:03+00:00Added an answer on May 18, 2026 at 9:12 pm

    You could add a class for each manufacturer, colour, etc. then simply disable by class. I assume here there’s a results hash keyed off manufacturer:

    results['Trusardi'] = 5 
    results['Armani' = 0
    

    ..then:

    $("#filters li.filtersGroup a").addClass("disabled");
    foreach (m in manufacturers) {
        if (manufacturers[m] > 0) {
           $("#filters li.filtersGroup a." + m).removeClass("disabled");
       }
    }
    

    etc.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm developing a JavaScript application that uses several open source JavaScript projects. All their
I am developing an eshop .At products page based on category i putted some
I'm developing a javascript-based application. Using id's to identify elements is often considered a
I am developing a javascript application. Rite now i am using E text editor
I'm working on developing a javascript framework and I don't want anyone to be
I am developing a web application that is supposed to display land traffic in
Issue What is your strategy for building a desktop-like webapp that needs to be
I can't figure out how to implement this in a performing way, so I
I'm using ColdFusion with Microsoft SQL Server 2005 and on occasion I get this

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.