4 Answers, 1 is accepted
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...
Can't attach an event on the close event of the popup window...
0
Hi Mel,
Kind Regards,
Vladimir Iliev
the Telerik team
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
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):
Regards,
Vladimir Iliev
Telerik
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.