This question is locked. New answers and comments are not allowed.
Hi,
I have a window that is defined as follows:
I load it with an Ajax request ("_Content" is an action in my controller):
Now, my problem is with the WindowName_onLoad method. I do some initialization of the contents of the window there. But if I do it synchronously, it doesn't work. The only solution I found is to do it after a certain delay:
Doesn't work:
Works:
Same issue happens if I don't use the onLoad event, but do the initializations after the open() call.
I'd like to understand why this works that way, and is there a better way to do it, as I don't find it very clean (it works with a timeout value of 500, but not 100, for example).
Thanks.
I have a window that is defined as follows:
@{Html.Telerik().Window() .Name("WindowName") .Title("Title") .ClientEvents(e => e.OnLoad("WindowName_onLoad")) .Width(850).Height(500) .Draggable(true).Resizable().Buttons(b => b.Maximize().Close()) .Modal(true) .Visible(false) .Render();}I load it with an Ajax request ("_Content" is an action in my controller):
var wnd = $('#WindowName).data('tWindow');wnd.ajaxRequest('_Content', { //...json parameters...});wnd.center().open();Now, my problem is with the WindowName_onLoad method. I do some initialization of the contents of the window there. But if I do it synchronously, it doesn't work. The only solution I found is to do it after a certain delay:
Doesn't work:
function WindowName_onLoad() { // do initializations};Works:
function WindowName_onLoad() { window.setTimeout(function () { // do initializations }, 500);};Same issue happens if I don't use the onLoad event, but do the initializations after the open() call.
I'd like to understand why this works that way, and is there a better way to do it, as I don't find it very clean (it works with a timeout value of 500, but not 100, for example).
Thanks.