From 991fb38d07b6286cfd7729e3ef5c5960306672aa Mon Sep 17 00:00:00 2001 From: Adam R Claxton Date: Tue, 4 Apr 2017 18:25:02 -0400 Subject: [PATCH] Fixed 'other' filter bug on listing page --- WebContent/html/javascript/listing.jsp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/WebContent/html/javascript/listing.jsp b/WebContent/html/javascript/listing.jsp index 6aeb139..7da247d 100644 --- a/WebContent/html/javascript/listing.jsp +++ b/WebContent/html/javascript/listing.jsp @@ -111,6 +111,18 @@ function applyFilter() { if (activeHOptions[j] == devices[i].hardware){ hardwareMatch = true; } + // now we must handle the 'other' case + // there is no 'other' catagory, so if that is the option selected we must make sure + // that the device in question is not one of the categories we DO have options for + if(activeHOptions[j] === 'Other') + { + var othermatch = true; + for (var k = 0; k < hardwareOptions.length; k++) { + if(devices[i].hardware == hardwareOptions[k].getAttribute('data-type')) + othermatch = false; + } + if(othermatch) hardwareMatch = true; + } } if (activeHOptions.length == 0) { @@ -121,6 +133,18 @@ function applyFilter() { if (activeSOptions[j] == devices[i].manufacturer){ softwareMatch = true; } + // now we must handle the 'other' case + // there is no 'other' catagory, so if that is the option selected we must make sure + // that the device in question is not one of the categories we DO have options for + if(activeSOptions[j] === 'Other') + { + var othermatch = true; + for (var k = 0; k < softwareOptions.length; k++) { + if(devices[i].manufacturer == softwareOptions[k].getAttribute('data-type')) + othermatch = false; + } + if(othermatch) softwareMatch = true; + } } if (activeSOptions.length == 0) {