MVC Wrapper breaking on second call

2 posts, 0 answers
  1. Harper
    Harper avatar
    6 posts
    Member since:
    Oct 2013

    Posted 12 May 2014 Link to this post

    I set up a window using the Fluent wrappers like so:
    @(Html.Kendo().Window().Name("detailsWindow").Visible(false))

    I have a JavaScript function (wired to a grid's custom command  - but I don't think that's relevant) that opens the window and refreshes it based on the grid data:
    function popupDetailsWindow(e, a){
         var detailsWindow = $('#detailsWindow').data('kendoWindow');
         var item = this.dataItem($(e.currentTarget).closest("tr"));
         var url = '@Url.Action("Details", "Controller", new { id = "__id__" })';
         var refreshUrl = url.replace('__id__', item.ItemId);
         detailsWindow.refresh(refreshUrl);
         detailsWindow.open();
    }

    This works fine the first time, then fails on the refresh() call, with an error that 'detailsWindow' is undefined. When I remove the MVC helper code, put in a div with Id "detailsWindow", and call $('detailsWindow').kendoWIndow(); after the document loads, it works fine. Is this a bug in the wrapper code, or am I doing something wrong?
  2. Alexander Popov
    Admin
    Alexander Popov avatar
    1416 posts

    Posted 14 May 2014 Link to this post

    Hello Harper,

    It looks like the Window's HTML element does not exist the second time popupDetailsWindow is executed, hence the detailsWindow becomes undefined. Sharing code snippets, live link, or ideally - a runnable sample project where the issue is reproduced would help us pinpoint the exact reason for this behavior and advise you further. 

    Regards,
    Alexander Popov
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  3. Kendo UI is VS 2017 Ready
Back to Top