Sidebar "close" event is triggered when the sidebar is opened

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


4 Replies 1 reply marked as answer

IL Indhumathy Loganathan Syncfusion Team July 21, 2022 08:09 AM UTC

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');

  }

}


Sample: https://stackblitz.com/edit/angular-jw9qnx-lwu6ky?devToolsHeight=33&file=app.component.html,app.component.ts


Please check the sample and get back to us if you need any further assistance.


Regards,

Indhumathy L


Marked as answer

PD Prerak Desai April 3, 2023 10:41 AM UTC

this is not work for me .because close event not call on dropdown value select



PD Prerak Desai replied to Indhumathy Loganathan April 3, 2023 11:40 AM UTC

every time not work 




IL Indhumathy Loganathan Syncfusion Team April 4, 2023 02:55 PM UTC

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.


Loader.
Up arrow icon