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

How to determine if Window is initialized

3 Answers 434 Views
Window
This is a migrated thread and some comments may be shown as answers.
Regis
Top achievements
Rank 1
Regis asked on 11 Sep 2014, 09:56 AM
Hello, I need to check if the Window is already init, if possible. 

Do you know if there is a good way to know this ? Without use a parameter in my controller would be best.

Thanks

3 Answers, 1 is accepted

Sort by
0
Dimiter Madjarov
Telerik team
answered on 11 Sep 2014, 12:22 PM
Hello Regis,


You could use the approach demonstrated in our demos, which checks if the corresponding kendoWindow data exists.
E.g.
var window = $("#window");
if (window.data("kendoWindow")){
   //window is initialized
}

Regards,
Dimiter Madjarov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Regis
Top achievements
Rank 1
answered on 11 Sep 2014, 12:45 PM
Hello Dimiter,

Thanks for your answer. I tried this before but this is not the solution I need (I think).
I may have misspoken.

I have a first window with content. When I click on a button I need to open a second window. But I declare this second window in the first. Then With javascript I load the content of the second window When I click on the button. 
Like this : 

@{
    Html.Kendo().Window().Name("HeaderFolder")
    .Title(@Resources.WindowFolderCreateBody)
    .Actions(actions => actions
    .Minimize()
    .Maximize()
    .Close()
    )
    .Visible(false)
    .Modal(true)
    .Resizable()
    .Draggable(true)
    .Width(600)
    .Render();
}
<script>
$("#HeaderFolderForm").click(function (e) {
 
var wndFolderHeader = $("#HeaderFolder").data("kendoWindow");
var AddressFolder = $("#Address-Folder").data("kendoWindow");
 
 if (wndFolderHeader) {
            AddressFolder.close();
            wndFolderHeader.refresh({
                data: {
                    FolderID: FolderID,
                    NextWindow: NextWindow
                },
                url: "Folder/HeaderFolder",
            });
            wndFolderHeader.open();
            wndFolderHeader.center();
        }
        else
        {
            AddressFolder.close();
        }
)};
</script>

The problem is my 2nd window always exist. 
May I can know if the content is load ? 

I wan't to do this because I have a menu that allows me to change the window without having to go in the other previously open window (it is a sequence of form that I need once, but that can be retraced as wanted)

Thanks for all,

Regards,




0
Accepted
Dimiter Madjarov
Telerik team
answered on 15 Sep 2014, 07:24 AM
Hi Regis,


In order to know when the content of window is loaded, you should bind to the refresh event and execute the custom logic in the event handler.
E.g.
.Events(events => events.Refresh("onRefresh"))

Regards,
Dimiter Madjarov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Window
Asked by
Regis
Top achievements
Rank 1
Answers by
Dimiter Madjarov
Telerik team
Regis
Top achievements
Rank 1
Share this question
or