How to determine if Window is initialized

4 posts, 1 answers
  1. Regis
    Regis avatar
    8 posts
    Member since:
    May 2014

    Posted 11 Sep 2014 Link to this post

    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
  2. Dimiter Madjarov
    Admin
    Dimiter Madjarov avatar
    2153 posts

    Posted 11 Sep 2014 Link to this post

    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.

     
  3. UI for ASP.NET MVC is VS 2017 Ready
  4. Regis
    Regis avatar
    8 posts
    Member since:
    May 2014

    Posted 11 Sep 2014 Link to this post

    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,




  5. Answer
    Dimiter Madjarov
    Admin
    Dimiter Madjarov avatar
    2153 posts

    Posted 15 Sep 2014 Link to this post

    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.

     
Back to Top
UI for ASP.NET MVC is VS 2017 Ready