Hide "Filter Services"
Hoping some of the JS experts out there know if it possible to change the box to match the search catalog box, or just hide it from view.
Thanks
Best Answer
-
Konstantin_Slavin-Bo Customer Ninja IT Monkey ✭✭✭✭Or, you should probably wrap it in a check for whether you're on the right page, so this is probably better:
$(document).ready(function (){<br> if (document.URL.indexOf("ServiceCatalog/Listing") === -1) {<br> return; <br> }<br> <br> // Hide filter input box<br> (($('.sc-filter')).find('input')).hide();<br><br>});
5
Answers
To confirm, we are taking about this Home page and this box, right?
Attempted on my Staging and production environments adding directly in custom.js. It remained in both IE11 and Chrome
Portal version 8.1.0.2012
Can you try the command directly in Chrome's devtools? Navigate to the page and press F12 to open DevTools, then select the console tab and input this line:
Does the box disappear?
What text appears right after?
Does this line return true or false?
[input.form-control.sc-text-search.ng-pristine.ng-untouched.ng-valid, prevObject: init(1), context: document, selector: ".sc-filter input"]
Running the True/False is returning false.
Attempted to remove the condition from the custom.js but still not firing. (non console errors)
Attempted to modify the rule for the indexof and all returned false.
Weird part if changed to (document.URL.indexOf("ServiceCatalog/RequestOffering") === -1) it returned true.
So modified the custom.js and still did not work. It must be one of environments security rules. Will need to dig. Thanks
if
is supposed to return false, so that's a good thing! The bad thing is, that then I can't explain why it isn't working.You won't necessarily get any errors in console, if there's an error in
custom.js
.You can try to add a
console.log("hiding box");
right above the(($('.sc-filter')).find('input')).hide();
line, and then go the page, open devtools and reload the page, and see if you see "hiding box" in the console. If you do, then theif
is entered and.hide()
should also fire. If you don't then there's a problem.You could try and just insert the
.hide()
line somewhere in the "root" ofcustom.js
, so it doesn't do any check before running the function. That absolutely should work, if there's no other errors in yourcustom.js
.sc-filter > input {display: none !important}
All gone.
Ah okay, good that you got it working. And right, my initial answer was actually not the best approach; doing it directly in css as you did is much better.