This question is locked. New answers and comments are not allowed.
montgomery
Top achievements
Rank 1
montgomery
asked on 16 Sep 2010, 07:03 PM
Hi All,
I'm making a generic window that lets us "popup" a modal window from a grid to delete the selected object. To populate the window I'm using the ajaxRequest method on the window object, as nachid described in this thread here.
The ajax request works great and I get the window. However, I cannot close the window, either from the window itself or from a test button on the main page (if I disable modal for testing purposes). After tracing the javascript, it appears it will not close because the tWindow element in data is missing. In other words, this code: var window = $("#<%=Model.WindowName%>").data("tWindow"); will always be null. I've verified that $("#<%=Model.WindowName%>"); exists.
To further test, I disabled the ajaxRequest call when opening the window and I can close it fine from the test button. So it seems the ajaxRequest call nulls out the data("tWindow") key. has anyone else seen this behavior? NOTE: I can close out the window fine using the standard .Buttons(buttons => buttons.Close()) but would really prefer being able to use window.close() in conjunction with ajaxRequest. Unfortunately I don't have an easy sample project at this time. If necessary I can create one early next week.
I'm making a generic window that lets us "popup" a modal window from a grid to delete the selected object. To populate the window I'm using the ajaxRequest method on the window object, as nachid described in this thread here.
The ajax request works great and I get the window. However, I cannot close the window, either from the window itself or from a test button on the main page (if I disable modal for testing purposes). After tracing the javascript, it appears it will not close because the tWindow element in data is missing. In other words, this code: var window = $("#<%=Model.WindowName%>").data("tWindow"); will always be null. I've verified that $("#<%=Model.WindowName%>"); exists.
To further test, I disabled the ajaxRequest call when opening the window and I can close it fine from the test button. So it seems the ajaxRequest call nulls out the data("tWindow") key. has anyone else seen this behavior? NOTE: I can close out the window fine using the standard .Buttons(buttons => buttons.Close()) but would really prefer being able to use window.close() in conjunction with ajaxRequest. Unfortunately I don't have an easy sample project at this time. If necessary I can create one early next week.
6 Answers, 1 is accepted
0
Hello montgomery,
We are really not sure why this may happen. Could you please provide more details? You can open a support ticket and attach a short sample application showing that issue.
Regards,
Atanas Korchev
the Telerik team
We are really not sure why this may happen. Could you please provide more details? You can open a support ticket and attach a short sample application showing that issue.
Regards,
Atanas Korchev
the Telerik team
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Public Issue Tracking
system and vote to affect the priority of the items
0
montgomery
Top achievements
Rank 1
answered on 20 Sep 2010, 06:26 PM
Thanks for the quick reply. I will create a small sample project and open the ticket. If I can't reproduce the issue in a small sample project I will post the solution/problem.
0
Kevin Schneider
Top achievements
Rank 1
answered on 24 Jan 2011, 10:25 PM
Was there ever a resolution posted for this issue? I'm seeing the same behavior. Using window.ajaxRequest(url) wipes out .data('tWindow')
0
Hello David,
We still cannot reproduce the depicted issue. I will ask you to send us a simple test project which replicates the described problem. Thus we will be able to review it locally and advice you further.
Regards,
Georgi Krustev
the Telerik team
We still cannot reproduce the depicted issue. I will ask you to send us a simple test project which replicates the described problem. Thus we will be able to review it locally and advice you further.
Regards,
Georgi Krustev
the Telerik team
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Public Issue Tracking
system and vote to affect the priority of the items
0
Kevin Schneider
Top achievements
Rank 1
answered on 25 Jan 2011, 05:38 PM
I've been investigating this behavior and I have found the reason as to why this might occur:
ajaxRequest(<url>) can only be used to pull back "local" url's. Local url's are treated differently from external url's by the window. When the control initially renders if it is an external url it will display it in an iframe (it determines if a url is external/internal by doing some string parsing). If it is a local url however it will attempt to dump the content of the request directly into the window's inner div. Future calls using ajaxRequest with an external url will be ignored by the api. Calls to it with a local url will be behave the same as when the control originally renders itself.
So I was seeing this problem because I assumed it treated all url's the same as external and would simply use an iframe but this is not the case. If the local url you hit includes the jquery library script as part of its return then jquery will be reloaded and you will lose all stored data values (in this case tWindow - there may be other strange behaviors that would appear with jquery lib being loaded twice as well).
So..moral of the story is if you're loading local url's into the window you can only use partial views or you need to construct a full url (including http(s):) so that the window will treat it as an external url).
My only real issue here is that calls to ajaxRequest ignore external url's. Why can't the api simply call in to the internal iframe of the window and redirect it correctly? I can see it being an issue if the window originally loaded a local url since no iframe would be present but this could easily be document as unsupported (navigating from local to external and vice versa).
Cheers,
Kevin
ajaxRequest(<url>) can only be used to pull back "local" url's. Local url's are treated differently from external url's by the window. When the control initially renders if it is an external url it will display it in an iframe (it determines if a url is external/internal by doing some string parsing). If it is a local url however it will attempt to dump the content of the request directly into the window's inner div. Future calls using ajaxRequest with an external url will be ignored by the api. Calls to it with a local url will be behave the same as when the control originally renders itself.
So I was seeing this problem because I assumed it treated all url's the same as external and would simply use an iframe but this is not the case. If the local url you hit includes the jquery library script as part of its return then jquery will be reloaded and you will lose all stored data values (in this case tWindow - there may be other strange behaviors that would appear with jquery lib being loaded twice as well).
So..moral of the story is if you're loading local url's into the window you can only use partial views or you need to construct a full url (including http(s):) so that the window will treat it as an external url).
My only real issue here is that calls to ajaxRequest ignore external url's. Why can't the api simply call in to the internal iframe of the window and redirect it correctly? I can see it being an issue if the window originally loaded a local url since no iframe would be present but this could easily be document as unsupported (navigating from local to external and vice versa).
Cheers,
Kevin
0
Hello Kevin,
Georgi Krustev
the Telerik team
Thank you for drawing our attention to this issue and for the concrete explanation of the issue.
I have created an PITS item devoted on this issue. Depending on the users interest will determine whether to implement it. For the time being will update the documentation to highlight that this is not supported scenario.
I have updated your Telerik points.
Georgi Krustev
the Telerik team
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Public Issue Tracking
system and vote to affect the priority of the items