pop-up editor events

5 posts, 0 answers
  1. MelF
    MelF avatar
    11 posts
    Member since:
    Aug 2012

    Posted 28 Sep 2012 Link to this post

    has anyone had any success with the following?? the function does not get called. Thank you!

          .Editable(editing => editing.Mode(GridEditMode.PopUp).Window(w => w.Events(e => e.Close("OnClose"))))
  2. Stéphan Parrot
    Stéphan Parrot avatar
    70 posts
    Member since:
    Apr 2010

    Posted 26 Oct 2012 Link to this post

    I'd like to know too because I have the very same problem!
    Can't attach an event on the close event of the popup window...
  3. UI for ASP.NET MVC is VS 2017 Ready
  4. Vladimir Iliev
    Admin
    Vladimir Iliev avatar
    2172 posts

    Posted 31 Oct 2012 Link to this post

    Hi Mel,

     
    Please note that currently the Window object is exposed to enable setting the Window title and other options currently are not serialized to the client side. To be able to attach event handler to the Popup window you should use the Edit event of the Grid. Please check the example below:

    function onEdit(e) {
        //Triggered when the window is closed (always)
        e.container.data("kendoWindow").bind("deactivate", function () {
            //Your custom logic
        })
     
        //Triggered when a Window is closed (by a user or through the close() method)
        e.container.data("kendoWindow").bind("close", function () {
            //Your custom logic
        })
    }


    Kind Regards,
    Vladimir Iliev
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  5. Michael
    Michael avatar
    8 posts
    Member since:
    Jan 2009

    Posted 11 Oct 2014 in reply to Vladimir Iliev Link to this post

    This doesn't appear to work anymore. I'm on the latest version, and I copied the code exactly as-is and put some alerts in for testing and it didn't fire the other alerts except "edit row". Also, even if this did work, you didn't list any code to reference the actual window to access the window title for example. That would also be helpful.

    function grdCustomers_onEdit(e) {
            alert("edit row");
            e.container.data("kendoWindow").bind("open", function () {
                alert("open");
                if (e.model.isNew()) {
                    alert("new win");
                } else {
                    alert("edit win");
                }
            })
        }
  6. Vladimir Iliev
    Admin
    Vladimir Iliev avatar
    2172 posts

    Posted 13 Oct 2014 Link to this post

    Hi Michael,

    Please check the updated code for the latest version below (the "open" event of the window cannot be used as it's already opened when the "edit" event of the grid is triggered):

    function onEdit(e) {
        //get window object
        var kendoWindow = e.container.data("kendoWindow");
             
        if (e.model.isNew()) {
            //set options using the setOptions method
            kendoWindow.setOptions({
                title: "New record!"
            });
        } else {
            //set options using the setOptions method
            kendoWindow.setOptions({
                title: "Old record!"
            });
        }
    }

    Regards,
    Vladimir Iliev
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
Back to Top
UI for ASP.NET MVC is VS 2017 Ready