perform action on kendo window custom button click

2 posts, 0 answers
  1. Ravi
    Ravi avatar
    17 posts
    Member since:
    Oct 2012

    Posted 16 Nov 2012 Link to this post

    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
  2. Ron DeFreitas
    Ron DeFreitas avatar
    26 posts
    Member since:
    Apr 2010

    Posted 02 Jan 2013 Link to this post

    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
         }

  3. Kendo UI is VS 2017 Ready
Back to Top