This is a migrated thread and some comments may be shown as answers.
Append Close button to Window
2 Answers 151 Views
This is a migrated thread and some comments may be shown as answers.
Ruairi
Top achievements
Rank 1
Ruairi asked on 01 Apr 2014, 12:05 PM
Using javasript I programatically create my dialogs as show below. In the JavaScript I  want to append a Close button to the bottom of the content of each dialog. Is this possible?


function kendoDialogCreate(dialogName) {
var dialog =
    $("#" + dialogName).kendoWindow({
      width: "800px",
      title: "",
      modal: true,
      actions: ["Custom", "Close", "Minimize", "Maximize"],
      visible: false,
      close: kendoDialogDeactivate,
      refresh: kendoDialogRefresh,
      error: kendoDialogError
    });
 
//Add close button here???
 
}

2 Answers, 1 is accepted

Sort by
0
Alexander Valchev
Telerik team
answered on 01 Apr 2014, 01:10 PM
Hello Tyler,

It is possible to append a custom button to the bottom of the window in the following way:
$("#wnd").kendoWindow({
    width: "800px",
    title: "",
    modal: true,
    actions: ["Custom", "Close", "Minimize", "Maximize"],
    visible: false
}).data("kendoWindow")
.element
.append($('<a class="k-button">button</a>')); //append button

In order to close the window you should hook up to the click event of that button and use the close method to close the widget.

Regards,
Alexander Valchev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Ruairi
Top achievements
Rank 1
answered on 01 Apr 2014, 01:34 PM
Thanks for reply. However I found the real problem. After creating the dialog I call javascript methods to refresh its content with a specific URL as below

dialog.refresh({
      url: url,
      data: urlData
    });

This was refreshing the dialog content thus removing the Close button I added. To get around this in the refresh event I added the button to close the dialog using the following:

//Add the Close button after refresh
    $("#" + dialogName).append("<button id='" + closeBtnName + "' class='k-button saveButtonRight'>Close</button>");
    $("#" + closeBtnName).click(function () {
      dialog.close();
    });

Happy Days it works!

Asked by
Ruairi
Top achievements
Rank 1
Answers by
Alexander Valchev
Telerik team
Ruairi
Top achievements
Rank 1
Share this question
or