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

perform action on kendo window custom button click

1 Answer 396 Views
Window
This is a migrated thread and some comments may be shown as answers.
Ravi
Top achievements
Rank 1
Ravi asked on 16 Nov 2012, 10:07 AM
Hello,

by using the below code i am trying to open the kendo window on button click this is working fine. 
 function OpenWindow() {
        var dialog = $("#window-prototype").clone().kendoWindow({
            width: "500px",
            height: "280px",
            modal: false,
            resizable: true,
            actions: ["Custom", "Minimize", "Maximize", "Close"],
            title: "OrderEntry"
        }).show().data("kendoWindow").open().center();

my requirement is i need to perform some action on custom button click on kendo window.So I added event in the javascript function

 function OpenOrderEntry() {
            var dialog = $("#window-prototype").kendoWindow({
            width: "500px",
            height: "280px",
            modal: false,
            resizable: true,
            actions: ["Custom", "Minimize", "Maximize", "Close"],
            title: "OrderEntry"
        }).data("kendoWindow").wrapper.find(".k-custom").click(function (e) {
            alert("Custom action button clicked");
            e.preventDefault();
        });
        dialog.data("kendoWindow").open();   <== Error
    }

but it is throwing the below given error "Microsoft JScript runtime error: 'data(...)' is null or not an object".

Regards,
Ravi

1 Answer, 1 is accepted

Sort by
0
Ron DeFreitas
Top achievements
Rank 2
answered on 02 Jan 2013, 09:17 PM
Your chaining looks like it's breaking your value of dialog, because you were returning the jQuery object from the FIND method rather than the kendo window.  Try this:

function OpenOrderEntry() {
            var dialog = $("#window-prototype").kendoWindow({
            width: "500px",
            height: "280px",
            modal: false,
            resizable: true,
            actions: ["Custom", "Minimize", "Maximize", "Close"],
            title: "OrderEntry"
         }).data("kendoWindow");
     dialog.wrapper.find(".k-custom").click(function (e) {
             alert("Custom action button clicked");
             e.preventDefault();
         }); 
         dialog.data("kendoWindow").open();   <== Error
     }

Tags
Window
Asked by
Ravi
Top achievements
Rank 1
Answers by
Ron DeFreitas
Top achievements
Rank 2
Share this question
or