Getting error Uncaught TypeError: Cannot read property 'occurrenceByUid' of undefined when having Custom event template

6 posts, 0 answers
  1. Coolasia
    Coolasia avatar
    19 posts
    Member since:
    Apr 2014

    Posted 21 Apr 2015 Link to this post

    Hi Telerik Team,

    I have defined custom event template for my scheduler. When I move event in the scheduler I am getting errror as "Uncaught TypeError: Cannot read property 'occurrenceByUid' of undefined".

    When I debugged the Javascript and found that the error is coming in the below code

    (function(data
    /**/) {
    var $kendoOutput, $kendoHtmlEncode = kendo.htmlEncode;with(data){$kendoOutput='\n    ';var uid = target.attr("data-uid");;$kendoOutput+='\n    ';var scheduler = target.closest("[data-role=scheduler]").data("kendoScheduler");;$kendoOutput+='\n    ';var model = scheduler.occurrenceByUid(uid);;$kendoOutput+='\n   \n    ';if(model) {;$kendoOutput+='\n        <strong>Job Start:</strong> '+(kendo.format('{0:ddd M/dd, hh:mm tt}',model.start))+'<br />\n        <strong>Job End:</strong> '+(kendo.format('{0:ddd M/dd, hh:mm tt}',model.end))+'<br />\n        <strong>Job Details:</strong> '+(model.title)+'<br />\n    <strong>Job Address:</strong> '+(model.Address)+'\n    ';} else {;$kendoOutput+='\n        <strong>No event data is available</strong>\n    ';};$kendoOutput+='\n';}return $kendoOutput;
    })

     

    where the "var scheduler = target.closest("[data-role=scheduler]").data("kendoScheduler")" is undefined and the error is coming. Please help how to fix it.

  2. Coolasia
    Coolasia avatar
    19 posts
    Member since:
    Apr 2014

    Posted 22 Apr 2015 in reply to Coolasia Link to this post

    Hi Team,

    I want to add one more point for above error. I am using telerik tool tip for the scheduler event.

    The above error is the from the tooltip script.

     So please let me know where I am wrong.

  3. Vladimir Iliev
    Admin
    Vladimir Iliev avatar
    2196 posts

    Posted 23 Apr 2015 Link to this post

    Hello,

    From the provided information it seems that the scheduler object is not found when dragging the event outside the scheduler - you can improve the tooltip template as follows:

    #var uid = target.parent().attr("data-uid");#
    #var scheduler = target.closest("[data-role=scheduler]").data("kendoScheduler");#
    #var model =  scheduler ? scheduler.occurrenceByUid(uid) : null;#

    Regards,
    Vladimir Iliev
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  4. Coolasia
    Coolasia avatar
    19 posts
    Member since:
    Apr 2014

    Posted 23 Apr 2015 in reply to Vladimir Iliev Link to this post

    Hi Vladimir Iliev,

     Thank you for the solution.

    This fixed the error but I found something new, the tool tip is displaying blank when there is no model. I do not want to show like that, is it possible to hide it when there is no model. 

     Please see attached screen for easy understanding

  5. Coolasia
    Coolasia avatar
    19 posts
    Member since:
    Apr 2014

    Posted 27 Apr 2015 Link to this post

    Hi Telerik Team,

     Can some one please reply to my previous post.

    Thanks,

    Coolasia

  6. Vladimir Iliev
    Admin
    Vladimir Iliev avatar
    2196 posts

    Posted 27 Apr 2015 Link to this post

    Hello,

    In the described scenario the best way to hide the tooltip is to not showing it when dragging events. This can be achieved by improving the current filter as follows:

    filter: ".k-event:not(.k-event-drag-hint) > div"

    Regards,
    Vladimir Iliev
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
Back to Top