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

pop-up editor events

4 Answers 1456 Views
Grid
This is a migrated thread and some comments may be shown as answers.
MelF
Top achievements
Rank 1
MelF asked on 28 Sep 2012, 06:24 PM
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"))))

4 Answers, 1 is accepted

Sort by
0
Stéphan Parrot
Top achievements
Rank 1
answered on 26 Oct 2012, 06:53 PM
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...
0
Vladimir Iliev
Telerik team
answered on 31 Oct 2012, 07:51 AM
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!
0
Michael
Top achievements
Rank 1
answered on 11 Oct 2014, 05:09 AM
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");
            }
        })
    }
0
Vladimir Iliev
Telerik team
answered on 13 Oct 2014, 07:18 AM
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.

 
Tags
Grid
Asked by
MelF
Top achievements
Rank 1
Answers by
Stéphan Parrot
Top achievements
Rank 1
Vladimir Iliev
Telerik team
Michael
Top achievements
Rank 1
Share this question
or