37
Views
6
Comments
Trigger an action when the Outsystems UI Web Sidebar overlay is clicked to close

So when user click on overlay, I want to trigger an action before closing the side bar. In  side bar there is form so i want to check if value is changed in form, then it should show a popup if you want to discard and close then the sidebar will close on that discard and close button. How to achieve this?

2021-01-28 10-02-59
Muhammad Mahmudul Hasan

Hi @Buddy_Outsystems 

If you can provide OML, details with screen shot about what you're trying to achieve then it will be easier for community to help. 



UserImage.jpg
Buddy_Outsystems

Hi

@Muhammad Mahmudul Hasan 


Please find the oml here I want same thing to happen when we click on close button on sidebar the resetpopup appears and then it resets form value and close the side bar. Similarly I want the same behavior when we click on overlay or outside of sidebar so before closing sidebar it should show popup and then close the side bar is there any way to trigger any action when we click on overlay or outside of sidebar.


SideBar2024.oml
2021-01-28 10-02-59
Muhammad Mahmudul Hasan

Hi @Buddy_Outsystems 

It's possible by using some JS. Please follow below steps.

1. Provide your sidebar widget with a specific class in the extendedClasses property: 


2. In the action where you have your logic to Open the Sidebar,  place a javascript node where you pass that same class as input: 


3. Add below JS. From JS call your client action. 



Please check attached OML. 



SideBar2024_Updated.oml
UserImage.jpg
Buddy_Outsystems

Thanks, But I can see the sidebar close or triggers the action even if I am clicking on Sidebar that should not be case,It should only triggers when we click outside of sidebar. how can we distinguish click? Current , implementation not working properly.

2021-01-28 10-02-59
Muhammad Mahmudul Hasan

Hi @Buddy_Outsystems 

Please find the attached OML. 

Two changes. 

1. Added one new CSS classes "sidebar-contnt" & modified Css for build-in class.


2. Add "sidebar-contnt" class in form

SideBar_UpdatedClick.oml
UserImage.jpg
Buddy_Outsystems


still its behaving same not distinguishing the click if I try to change any value in form then it show reset popup.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.