Ashley Leggore Posted April 20, 2021 Share Posted April 20, 2021 I have java code within my page designer that creates a show/hide feature on a date filter based on whether you select the Report Type to be monthly, daily, or weekly. Currently, on run/page load this show/hide filter does not work until you click in the filter bar, then the date filter disappears. Im very new to javascript and Im unable to figure out how to add a piece of code that will make this happen at time of page load. Any suggestions Here is the sample javascript im currently using: var _checkColumn = REPORTTYPE; var _checkValue = Monthly; var _hideObjWithClass = .dateparam; $(body).on(blur, .ibx-select-item-list-paged-inner, function() { setTimeout(function() { var _page = document.querySelector(".pd-page").ibaObject; var _pageUtil = PageUtil.getPageUtil(_page); var amperManager = _pageUtil.getAmperManager(); var _filterValues = ""; amperManager._ampers.forEach(function(amper) { if ( amper.info.name == _checkColumn ) { _filterValues += amper.info.curValue + "##"; } }) console.log( _filterValues ) if(_filterValues.indexOf( _checkValue ) > -1) { $( _hideObjWithClass ).animate({opacity:0},350); } else { $( _hideObjWithClass ).animate({opacity:1},350); } }, 50); }); Link to comment Share on other sites More sharing options...
Martin Yergeau Posted April 20, 2021 Share Posted April 20, 2021 You need to put your code in a onInitialUpdate() function. This function is automatically called by the window_onload function without the need to specifically call it function onInitialUpdate() { <your code here> } Link to comment Share on other sites More sharing options...
Ashley Leggore Posted April 20, 2021 Author Share Posted April 20, 2021 Thank you MartinY. Im very unfamiliar with java script at all and its very new to me. So, when you say its called by the window_onload function, I dont have any code specifically for that in here like I would see in an HTML designer page. Im using the page designer. So do I need additional code besides what you provided I also tried that code you provided and could not get it to work. Link to comment Share on other sites More sharing options...
David Beagan Posted April 20, 2021 Share Posted April 20, 2021 I did a test. I created a Designer page and with a control on it and gave it a class dataparam. Then I added this Javascript to the page: var _hideObjWithClass = '.dateparam'; $.ready( $(_hideObjWithClass).animate({opacity:0},350) ); When I run the page, then the control is hidden. Link to comment Share on other sites More sharing options...
Ashley Leggore Posted April 20, 2021 Author Share Posted April 20, 2021 That worked! Thank you SO much. Link to comment Share on other sites More sharing options...
Joanne Quan 2 Posted January 29, 2022 Share Posted January 29, 2022 David, I am unable to hide my control using your JavaScript when the control is placed in a grid container. I can hide the whole grid container, but I dont know how to access the control inside the container. Do you have any ideas Link to comment Share on other sites More sharing options...
Martin Yergeau Posted January 31, 2022 Share Posted January 31, 2022 Have you tried this Identify your controls Unique identifier then use the below // to hide IbComposer_showHtmlElement('your Unique Identifier', false); // to show IbComposer_showHtmlElement('your Unique Identifier', true); Link to comment Share on other sites More sharing options...
Joanne Quan 2 Posted February 4, 2022 Share Posted February 4, 2022 I tried this and I got an error saying IbComposer_showHtmlElement is undefined. Just to clarify, Im working in the Page Designer, not the HTML Composer. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now