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

MVC Wrapper breaking on second call

1 Answer 50 Views
Window
This is a migrated thread and some comments may be shown as answers.
Harper
Top achievements
Rank 1
Harper asked on 12 May 2014, 07:10 PM
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?

1 Answer, 1 is accepted

Sort by
0
Alexander Popov
Telerik team
answered on 14 May 2014, 10:36 AM
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!
 
Tags
Window
Asked by
Harper
Top achievements
Rank 1
Answers by
Alexander Popov
Telerik team
Share this question
or