This is a migrated thread and some comments may be shown as answers.

Different closing behaviour for notifications

3 Answers 623 Views
Notification
This is a migrated thread and some comments may be shown as answers.
Kaan
Top achievements
Rank 1
Kaan asked on 09 May 2017, 04:52 PM

Hello!

How can I make info and success notifications disappear automatically after a few seconds, but have warning and error notifications to be closed manually by the user?

Best regards,

Kaan

3 Answers, 1 is accepted

Sort by
0
Accepted
Ivan Danchev
Telerik team
answered on 10 May 2017, 06:05 AM
Hello Kaan,

The autoHideAfter configuration option is applied to all Notification types, thus we can suggest setting it to 0 (disabling auto-hide) and conditionally hide the Notification depending on its type in the show event handler. Here's a sample dojo, which demonstrates this approach. The info Notification is hidden after 2 seconds, whereas the warning Notification does not auto-hide.

Regards,
Ivan Danchev
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Ryan
Top achievements
Rank 1
answered on 24 Feb 2020, 05:12 PM
Looking to implement the fix above, I've noticed a problem. If you show an info, while an warning is showing, it will hide both of them. Is there a way to target only the notification to be hidden?
0
Ryan
Top achievements
Rank 1
answered on 24 Feb 2020, 05:23 PM

Never mind, I figured it out. instead of using e.sender.hide(), you can use e.element.hide()

function onShow(e) {
  if(notificationType == "info") {
    setTimeout(function() {
      e.element.hide();
    }, 2000);
  }
  notificationType = "";
}
  

Tags
Notification
Asked by
Kaan
Top achievements
Rank 1
Answers by
Ivan Danchev
Telerik team
Ryan
Top achievements
Rank 1
Share this question
or