This question is locked. New answers and comments are not allowed.
Hi all,
I just wonder if there is any way to get his scenario to work:
I have a page with a hidden Window that loads a PartialView from the Controller: This partial view actually returns a list of items, all of them with a particular attribute data-id holding the item id...
Unfortunately this partial view does not know that it runs inside a window and therefore does not do anything but rendering that item list. Now this is the reason why I need to inject that specific behavior from the outside. All I wanted to do is to attach a click handler to all the items so they perform exactly what I want them to do:
And here comes the problem: This code only works when I delay the onLoad function in the JS-Debugger - obviously the Window has not yet loaded its content when the onLoad event is fired.
Isn't there a way to pass that Window control a Callback which is called when the request is finished? I could also use that .ajaxRequest method but do not find any documentation whether I can pass a callback handler or not.
Any help is greatly appreciated. Thanks!
I just wonder if there is any way to get his scenario to work:
I have a page with a hidden Window that loads a PartialView from the Controller: This partial view actually returns a list of items, all of them with a particular attribute data-id holding the item id...
<% Html.Telerik().Window() .Name("SelectionWindow") .Visible(false) .ClientEvents( events => events.OnLoad("onLoad")) .LoadContentFrom("GetObjects") // preload... .Render(); %>Unfortunately this partial view does not know that it runs inside a window and therefore does not do anything but rendering that item list. Now this is the reason why I need to inject that specific behavior from the outside. All I wanted to do is to attach a click handler to all the items so they perform exactly what I want them to do:
function onLoad(e) { $('span[data-id]') .click(function (e) { e.preventDefault(); var id = $(this).data('id'); // get the selected id var url = '<%= Url.Action("CreateChildObject") %>'; $('#ObjectDetailsWindows').data('tWindow').ajaxRequest(url, {objectID: id }); // load the details form into another window $('#ObjectDetailsWindows').data('tWindow').center().open(); $('#SelectionWindow').data('tWindow').close(); });}And here comes the problem: This code only works when I delay the onLoad function in the JS-Debugger - obviously the Window has not yet loaded its content when the onLoad event is fired.
Isn't there a way to pass that Window control a Callback which is called when the request is finished? I could also use that .ajaxRequest method but do not find any documentation whether I can pass a callback handler or not.
Any help is greatly appreciated. Thanks!