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

Dynamic Url in Window

3 Answers 693 Views
Window
This is a migrated thread and some comments may be shown as answers.
Rich Lasker
Top achievements
Rank 1
Rich Lasker asked on 05 Oct 2012, 01:32 AM
I have a grid with custom commands to view an order's details. When clicking on the button I want to launch a Kendo Window and add the order's id into the url of the content. Is this possible?

var wnd = $("#window").kendoWindow({
title: "Order Details",
modal: true,
visible: false,
resizable: false,
width: 400
}).data("kendoWindow");

function showOrder(e) {
e.preventDefault();
var dataItem = this.dataItem($(e.currentTarget).closest("tr"));
var url = '<%= ResolveUrl("~/MyOrder.aspx?orderId=") %>' + dataItem.Id;
wnd.content(url);
wnd.center().open();
}


3 Answers, 1 is accepted

Sort by
0
Accepted
Nohinn
Top achievements
Rank 1
answered on 05 Oct 2012, 08:27 AM
function createWindow(id) {
  $(document.body).append('<div id="myDynamicWindow"></div>');
  $('#myDynamicWindow').kendoWindow({
     title: "Order Details",
     modal: true,
     resizable: false,
     width: 400,
     content: '<%= ResolveUrl("~") + "/MyOrder.aspx?orderId=" + id,
     close: function() {
        setTimeout(function() {
            $('#myDynamicWindow').kendoWindow('destroy');
        }, 200);
     }
  }).data('kendoWindow').center();
}
 
function showOrder(e) {
    e.preventDefault();
    var dataItem = this.dataItem($(e.currentTarget).closest("tr"));
    createWindow(dataItem.Id);
}
0
Rich Lasker
Top achievements
Rank 1
answered on 07 Oct 2012, 08:57 PM
Thanks that worked well. Do you know how to better control where the window pops up? I need it to open upper center to give more room for the order display.
0
Nohinn
Top achievements
Rank 1
answered on 08 Oct 2012, 08:07 AM
If using the center function of the window is not enough, once the window is created you can position it like this:
$('#myDynamicWindow').parent().css({
    top: '120px',
    left: '340px'
});

Just play a bit with the top and left properties until you get what you like.
Tags
Window
Asked by
Rich Lasker
Top achievements
Rank 1
Answers by
Nohinn
Top achievements
Rank 1
Rich Lasker
Top achievements
Rank 1
Share this question
or