-
Vasileios ThanasiasHas successfully completed the online course Basics (100)1 year ago #35375
Hello, is there any way (event) to reset a screen. I have some checkboxes checked, but when I want to return to the screen, I would like to have all the checkboxes unchecked, as in the begining.
Jennifer HäfnerHas successfully completed the online course Intermediate (200)Has successfully completed the online course Advanced (300)Has successfully completed the online course Basics (100)Has successfully completed the online course Advanced (310)Has successfully completed the online course Advanced (320)Has successfully completed the Intermediate CertificationHas successfully completed the Advanced Certification1 year ago #35411::Another way to reset screens is to implement them as modules and then loading these modules in your app. When unloading the module and then loading it again, all elements will be re-initialized and therefore reset.
You can find more about modules here:
- Documentation: https://community.simplifier.io/doc/current-release/applications/modularize-your-apps/
- Advanced Course on Debugging (Create a Module): https://community.simplifier.io/browser-debugging-tools-debugging-modules-creating-a-module/
- Advanced Course on Debugging (Load a Module): https://community.simplifier.io/browser-debugging-tools-debugging-modules-integrating-the-module/
Jennifer HäfnerHas successfully completed the online course Intermediate (200)Has successfully completed the online course Advanced (300)Has successfully completed the online course Basics (100)Has successfully completed the online course Advanced (310)Has successfully completed the online course Advanced (320)Has successfully completed the Intermediate CertificationHas successfully completed the Advanced Certification1 year ago #35409::Hi Vasileios,
There is no built-in function that resets all elements on a screen, but you can implement it the following way:
Subscribe to the ‘onBeforeShow’ event of the screen you want to reset. After the event, execute this code (adapt it to your use case):
var aCheckboxes = $("#ScreenID").find(".sapMCb"); // get all checkboxes on the screen for (var i = 0; i < aCheckboxes.length; i++) { var sId = aCheckboxes[i].id; // get the ID of the element sap.ui.getCore().byId(sId).setSelected(false); // reset the checkbox }
Viewing 4 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic.