Hi! I have an unpleasant issue with the sidebar component, the "close" event is triggered when the sidebar is opened.
Here's a stacklblitz example.
Does anybody know how to solve or overcome it?
Thanks,
Sergiu
Hi Sergiu,
Greetings from Syncfusion support.
We have validated the reported issue in the shared sample. In your sample, the closeOnDocumentClick property has been enabled. Because of this, every time you click on the button, it triggers the close event. To prevent this from happening, you can cancel the close event when you perform a click on the button element. Please check the below code snippet.
|
close(args) { if (args.event.target.id == 'toggle') { //Cancel close event if the button is clicked. args.cancel = true; } else { console.log('close'); } } |
Please check the sample and get back to us if you need any further assistance.
Regards,
Indhumathy L
this is not work for me .because close event not call on dropdown value select
Prerak, When you enable closeOnDocumentClick, the Sidebar will get collapsed while you perform any click action within the main area. However, you can cancel the close action based on the corresponding target element within the Sidebar "close" event.
|
close(args) { if ( args.event.target.id == 'toggle' || args.event.target.classList.contains('e-input-group') || args.event.target.parentNode.closest('.e-ddl') != null ) { //Cancel close event if the button is clicked. args.cancel = true; } else { console.log('close'); } } |
Sample: https://stackblitz.com/edit/angular-kedyzk?file=src%2Fapp.component.html
Check out the shared sample and get back to us if you need any further assistance.