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

How to clear Window Content onOpen and show loading Indicator for window.ajaxRequest

2 Answers 95 Views
Window
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Jim
Top achievements
Rank 1
Jim asked on 24 Nov 2011, 12:34 PM
I am happily using a predefined hidden window to load a partial view via window.ajaxRequest().

When reopening the window to display another record the "old" window content is immediately shown.

The content gets updated with the new data when the ajaxRequest() finally returns.

So I would like to reset the window content in the onOpen() event, but how?

Furthermore I would like to display some loading animation to indicate activity, because some of the ajaxRequests takes a couple of seconds. Of course a spinning loading gif would be sufficiant.

So how to "inject" this content ajax gif in the onOpen()???

Thx
Jim

2 Answers, 1 is accepted

Sort by
0
Accepted
Alex Gyoshev
Telerik team
answered on 25 Nov 2011, 07:44 AM

$("#Window1").data("tWindow").content("<span class='t-icon t-loading'></span>");

All the best,
Alex Gyoshev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now
0
Jim
Top achievements
Rank 1
answered on 25 Nov 2011, 09:35 AM
Hello Alex,

Thanks for the prompt and accurate info.

Works like a charm.

<%=  Html.Telerik().Window()
        .Name("SomeWindow")
        .Title("SomeTitle")
        .ClientEvents(events => events
            .OnOpen("WinOnOpen")
            .OnRefresh("WinOnRefresh "))
        .Draggable(true)
        .Modal(true)
        .Visible(false)
        .Width(640)
        .Height(495)
        .Buttons(b => b.Close())
        .Resizable())
%>
 
function WinOnOpen(e) {
    $(this).data("tWindow").content("<span class='t-icon t-loading'></span>");
}
  
function WinOnRefresh(e) {
    $(this).data("tWindow").center();
}



Thx a lot
Jim
Tags
Window
Asked by
Jim
Top achievements
Rank 1
Answers by
Alex Gyoshev
Telerik team
Jim
Top achievements
Rank 1
Share this question
or