Dynamic LoadContentFrom using jquery

5 posts, 0 answers
  1. Jerry
    Jerry avatar
    70 posts
    Member since:
    Jan 2011

    Posted 19 Jan 2014 Link to this post

    Hi,


    I have a kendo window (child view) defined in the parent view which is set to hidden until the "Add" button is clicked.

    This window has the "LoadContentFrom" property set which calls a method in the controller.

    The parameters are currently static with only one value used every time the window is opened but is there any way to change just the parameters for "LoadContentFrom" using jquery?


    This is what the parent view looks like:
        @(Html.Kendo().Window()
            .Name("PurchaseOrderDetailWindow")
            .Title("Update Purchase Order")
            .Draggable()
            .Visible(false)
            .Iframe(true)
            .Width(1000)
            .Height(662)
            .Modal(true)
            .LoadContentFrom("PODetailView", "Home", new { isNewPO = "true", companyId = 2 })
            .Actions(actions => actions.Minimize().Maximize().Close())
            .Events(e => e.Close("WindowClosed"))
        )

    This is what the add button looks like (static loading of data)
        // Open window for new Purchase Order creation.
        function AddPurchaseOrder(e) {
            var window = $("#PurchaseOrderDetailWindow").data("kendoWindow");
            window.center().open();
        }

    Is there any way to modify the above AddPurchase method to dynamically change "LoadContentFrom("PODetailView", "Home", new { isNewPO = "true", companyId = 2 })"

    Mainly the "new {isNewPO = ....}" section,


    Thanks in advance
  2. Kiril Nikolov
    Admin
    Kiril Nikolov avatar
    2564 posts

    Posted 20 Jan 2014 Link to this post

    Hello Jerry,

    Dynamically changing the content property of the Kendo UI Window is not supported. You can destroy the widget and recreate it again, using the new content parameters. 

    Regards,
    Kiril Nikolov
    Telerik
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. Kendo UI is VS 2017 Ready
  4. Kiril Nikolov
    Admin
    Kiril Nikolov avatar
    2564 posts

    Posted 20 Jan 2014 Link to this post

    Hello Jerry,

    I forgot to add that it is possible to use the refresh() method of the Kendo UI Window, so you can load different content inside your window. 

    Please accept my apologies for not mentioning this in the first response.

    Regards,
    Kiril Nikolov
    Telerik
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  5. Bob
    Bob avatar
    138 posts
    Member since:
    Sep 2012

    Posted 30 Sep 2014 Link to this post

    Is it possible to delay the window from loading it's content until it is opened when configuring a LoadContextFrom action?
  6. Kiril Nikolov
    Admin
    Kiril Nikolov avatar
    2564 posts

    Posted 01 Oct 2014 Link to this post

    Hi Bob,

    You can use the refresh method to manually load the content of the window whenever needed. Here is the documentation about it:

    http://docs.telerik.com/kendo-ui/api/javascript/ui/window#methods-refresh

    You can listen for the open event and then load the content. More information about this event is available here:

    http://docs.telerik.com/kendo-ui/api/javascript/ui/window#events-open

    Regards,
    Kiril Nikolov
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
Back to Top
Kendo UI is VS 2017 Ready