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

Dynamic LoadContentFrom using jquery

4 Answers 1353 Views
Window
This is a migrated thread and some comments may be shown as answers.
Jerry
Top achievements
Rank 1
Jerry asked on 19 Jan 2014, 10:50 PM
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

4 Answers, 1 is accepted

Sort by
0
Kiril Nikolov
Telerik team
answered on 20 Jan 2014, 12:59 PM
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!
0
Kiril Nikolov
Telerik team
answered on 20 Jan 2014, 01:46 PM
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!
0
Bob
Top achievements
Rank 1
answered on 30 Sep 2014, 07:46 PM
Is it possible to delay the window from loading it's content until it is opened when configuring a LoadContextFrom action?
0
Kiril Nikolov
Telerik team
answered on 01 Oct 2014, 08:50 AM
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!
 
Tags
Window
Asked by
Jerry
Top achievements
Rank 1
Answers by
Kiril Nikolov
Telerik team
Bob
Top achievements
Rank 1
Share this question
or