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

data("kendoNotification") returns Undefined in ready function

3 Answers 206 Views
Notification
This is a migrated thread and some comments may be shown as answers.
michael
Top achievements
Rank 1
michael asked on 10 Nov 2014, 08:14 PM
I've defined a notification on my JSP page using the jsp taglib, and it works great if I'm using it in javascript from button actions or click events.  But if I try to access it as part of my ready function processing the following call returns 'undefined'.
var notification = $("#notification").data("kendoNotification");
It almost makes me think the widget hasn't fully initialized or something.  I want to avoid having to define everything via JS in the ready function, since that defeats the purpose of even having the taglib.  Am I doing something wrong, or is this not possible?
Thanks

3 Answers, 1 is accepted

Sort by
0
Alexander Popov
Telerik team
answered on 12 Nov 2014, 12:36 PM
Hello Michael,

I already replied to this query in the support ticket you opened. Basically this could happen in case the jQuery selector is not correct, the code is executed before the widget's initialization took place or in case an older JavaScript files are used.

Regards,
Alexander Popov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
serge
Top achievements
Rank 2
Bronze
Iron
Iron
commented on 23 May 2021, 02:17 PM

why this is could happen, is great to know, but also would be useful what to do in these cases...
Martin
Telerik team
commented on 25 May 2021, 12:34 PM

Could you please share a small example where I can observe the issue you are experiencing? In the case of Michael, a possible reason for the problem was that the code to initialize the Notification was executed before the HTML markup on the page. So I will need to be able to debug what is causing the issue on your side.

0
michael
Top achievements
Rank 1
answered on 12 Nov 2014, 02:02 PM
Yeah, sorry. I posted this before thinking to file a support ticket.  I replied to you there.  We can continue the conversation there.
Thanks
1
CHRISTOPHER
Top achievements
Rank 1
answered on 16 Sep 2019, 12:44 PM
Just for anyone else that comes along.  This happened to me in a MVC project where the document ready event code was placed before the span tag.  I would not have expected this.  However, simply moving the span tag with display:none set to the top of the body tag fixed the issue.
Tags
Notification
Asked by
michael
Top achievements
Rank 1
Answers by
Alexander Popov
Telerik team
michael
Top achievements
Rank 1
CHRISTOPHER
Top achievements
Rank 1
Share this question
or