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

Notifications not stacking

1 Answer 306 Views
Notification
This is a migrated thread and some comments may be shown as answers.
Valentin
Top achievements
Rank 1
Veteran
Valentin asked on 19 Apr 2021, 02:36 PM

Hi team,

I'm trying to setup notifications on my project, using your demo : https://demos.telerik.com/kendo-ui/notification/templates. I managed to make notifications appears like in your tutorial, but they are not stacking when multiple of them are open in the same time. 

Here's my code : 

function showNotification(_title, _txt, _type) {
    var notification = $("#notificationPopup").kendoNotification({
        position: {
            pinned: true,
            top: 30,
            right: 30
        },
        autoHideAfter: 0,
        stacking: "down",
        templates: [{
            type: "success",
            template: $("#successTemplate").html()
        }, {
            type: "warning",
            template: $("#warningTemplate").html()
        }, {
            type: "error",
            template: $("#errorTemplate").html()
        }]
    }).data("kendoNotification");
 
    notification.show({
        title: _title,
        message: _txt
    }, _type);
}

 

<span id="notificationPopup" style="display:none;"></span>
 
<script id="successTemplate" type="text/x-kendo-template">
    <div class="notifSuccess">
        <h3>#= title #</h3>
        <p>#= message #</p>
    </div>
</script>
 
<script id="warningTemplate" type="text/x-kendo-template">
    <div class="notifWarning">
        <h3>#= title #</h3>
        <p>#= message #</p>
    </div>
</script>
 
<script id="errorTemplate" type="text/x-kendo-template">
    <div class="notifError">
        <h3>#= title #</h3>
        <p>#= message #</p>
    </div>
</script>

 

I call showNotification() whenever I want one to appear, but they do one in front each other instead of stacking in the direction I indicated.

 

Any idea of what I missed ?

 

Best regards,

 

Valentin

 

1 Answer, 1 is accepted

Sort by
0
Accepted
Valentin
Top achievements
Rank 1
Veteran
answered on 20 Apr 2021, 07:40 AM
I found out what I was doing wrong. With this method, I am creating a new notification every time I call showNotification, and I shouldn't do that. I moved everything but my notification.show() inside a document.ready, so my kendo notification is only initialized once, and it works.
Tags
Notification
Asked by
Valentin
Top achievements
Rank 1
Veteran
Answers by
Valentin
Top achievements
Rank 1
Veteran
Share this question
or