Search code examples
javascriptjquerykendo-uipopupwindow

Kendo PopupWindow how do i set content to a jquery post?


We currently pass a query string to the content on a kendo popupwindow control to show dialogs that are loaded from partial views. Works fine but sometimes the query string is too long so we want to use the "POST" instead of get to get our data.

The content result supposedly supports this, but I have been unable to get it to work. (source: https://www.telerik.com/forums/post-method-support Here's what i've tried:

.kendoWindow({
            title: title,
            modal: true,
            actions: ["Close"],
            content: '{url: "'+content+'", type:"POST"}',
            height: height,
            ...

but that didn't work. The console shows this failed url:

http://localhost/Orders/%7Burl:%20%22/Orders/BulkAssign/?OrderIDs=106955&fetchDateUTC=2020-05-01%2016:45:37%22,%20type:%22POST%22}&_=1588351528462

I attempted to reproduce the syntax on the refresh code in the above link but that didn't work. You can see that it somehow split the url. The actual url is

localhost/orders/_bulkassign/?orderids...

Can someone please tell me the proper way to do content via jquery? I don't want to have to functionality that they've included in this control if don't have to, but I could load content into a div myself and point the content to it.


Solution

  • Instead of fill the content like what you've tried, Try with the refresh method after the window has been initialized. like this :

    $("#myWindow").kendoWindow({
           width: "75%",
           visible: false,
           actions: ["Close"],
           resizable: false,
           modal:true,
           title:"myWindow"
      }).data("kendoWindow");
    
    
    var window = $("#myWindow").data("kendoWindow");
    window.refresh({
        url:'',
        data: JSON.stringify(yourData),
        type: "Post",
        contentType: "application/json"
    });