Telerik Forums
UI for ASP.NET MVC Forum
1 answer
149 views

Hi,

 I need to be able to show some notifications that auto hide after 5 seconds and others that don't auto hide.  I am achieving this by using this code when I want to show a notification for 5 seconds:

 

01.var fadingnotification = $("#fadingnotification").kendoNotification({
02.    position: {
03.        pinned: true,
04.        bottom: 60,
05.        right: 30
06.    },
07.    stacking: "up",
08.    autoHideAfter: 5000,
09.    templates: [{
10.            type: "stickyinfonodismiss",
11.            template: $("#stickyInfoNoDismissTemplate").html()
12.        }, {
13.            type: "stickyinfo",
14.            template: $("#stickyInfoTemplate").html()
15.        }, {
16.            type: "info",
17.            template: $("#infoTemplate").html()
18.    }]
19.}).data("kendoNotification");
20. 
21.fadingnotification.show({
22.    message: msgToDisplay
23.}, "info");

and using the same code but with "autoHideAfter: 0" for the ones that I want to display without hiding.

 The problem I have is that this effectively initiates a new notification GUID each time so the notifications start again at the bottom of the screen each time even if there are already notifications on screen.

 Ideally I want to just change the autoHideAfter option without initialising a new notification and therefore a new GUID.

Any ideas?

Thanks,

Mark.

Plamen Lazarov
Telerik team
 answered on 25 Sep 2015
4 answers
224 views
Hi,
I'm basing my notifications on this demo: http://demos.telerik.com/aspnet-mvc/notification/templates
My templates are success, info, error, and warning.

@(Html.Kendo().Notification()
        .Name("notification")
        .Position(p => p.Pinned(true).Top(30).Right(30))
        .Stacking(NotificationStackingSettings.Down)
        .AutoHideAfter(0)
        .Templates(t =>
        {
            t.Add().Type("info").ClientTemplateID("infoTemplate");
            t.Add().Type("success").ClientTemplateID("successTemplate");
            t.Add().Type("error").ClientTemplateID("errorTemplate");
            t.Add().Type("warning").ClientTemplateID("warningTemplate");
        })
    )

Then I show them like this in JS...

notification.show({
    message: "Upload Successful",
}, "success");

I can set AutoHideAfter when I declare the notification, however I was wondering if it's possible to set AutoHideAfter for an individual template? 
That way I can disable autohide for all templates except the success template. 

Thanks for any help,
Joe

Joe
Top achievements
Rank 2
 answered on 06 Aug 2014
Narrow your results
Selected tags
Tags
+? more
Top users last month
Mark
Top achievements
Rank 1
Yurii
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Hon
Top achievements
Rank 1
Iron
Deltaohm
Top achievements
Rank 3
Bronze
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Mark
Top achievements
Rank 1
Yurii
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Hon
Top achievements
Rank 1
Iron
Deltaohm
Top achievements
Rank 3
Bronze
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?