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 am developing some client side Javascript that is using some JSON web services
I am developing some JavaScript that should work with either Prototype.js or JQuery, thus
I am currently developing a site and have a need for a javascript-based carousel/slider
I have to do some JavaScript in the future, so it is time to
I'm developing a JavaScript application that's meant to be run either from a web
I'm developing a javascript widget that depends on jQuery. The widget may or may
When developing JavaScript, I tend to separate JavaScript code out into different files and
I've been developing a Form Builder in Javascript, and coming up to the part
I like to keep javascript debugging enabled in my browser so when I'm developing
Developing a heavily XML-based Java-application, I recently encountered an interesting problem on Ubuntu Linux.

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.