I have a window with a list box and on the window close I'm trying to move the data from that list into a list in the parent window.
Here is the html snippet for the window content
Any idea why the code in my onClose event isn't doing anything?
Here is the html snippet for the window content
<
div
id
=
"selectcontactwindow"
class
=
"k-content"
>
<
script
type
=
"text/javascript"
>
$(document).ready(function () {
$("#parent").val("Select an Agency Contact");
$("#contactselect").kendoComboBox([
{ text: "Contact 1", value: 1 },
{ text: "Contact 2", value: 2}]);
$("#add").click(function () {
var obj = $("#contactselect option:selected");
if ($("#selectedcontacts option[value="+obj.val()+"]").length == 0) {
$("#selectedcontacts")
.append($("<
option
></
option
>")
.prop("value", obj.val())
.text(obj.text()));
}
});
$("#remove").click(function () {
$("#selectedcontacts option:selected").remove();
});
});
</
script
>
<
table
>
<
tr
>
<
td
>
<
label
for
=
"parent"
class
=
"k-label"
>Parent</
label
>
</
td
>
<
td
>
<
input
id
=
"parent"
disabled
=
"disabled"
type
=
"text"
class
=
"k-textbox"
/>
</
td
>
</
tr
>
<
tr
>
<
td
>
<
label
for
=
"contactselect"
class
=
"k-label"
>Select a Contact</
label
>
</
td
>
<
td
>
<
select
id
=
"contactselect"
class
=
"k-combobox"
placeholder
=
"Please select a contact"
>
</
select
>
</
td
>
</
tr
>
<
tr
>
<
td
>
<
label
for
=
"selectedcontacts"
class
=
"k-label"
>Selected Contacts</
label
>
</
td
>
<
td
>
<
select
id
=
"selectedcontacts"
multiple
=
"multiple"
class
=
"k-list-container"
style
=
"width: 100%"
>
<
option
value
=
"11"
>Contact 11</
option
>
<
option
value
=
"12"
>Contact 12</
option
>
</
select
>
</
td
>
</
tr
>
<
tr
>
<
td
></
td
>
<
td
>
<
button
id
=
"add"
class
=
"k-button"
>Add</
button
>
<
button
id
=
"remove"
class
=
"k-button"
>Remove</
button
>
</
td
>
</
tr
>
</
table
>
</
div
>
Here is the code for the parent window.<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<
html
xmlns
=
"http://www.w3.org/1999/xhtml"
>
<
head
>
<
title
></
title
>
<
link
href
=
"../Styles/kendo.common.min.css"
type
=
"text/css"
rel
=
"stylesheet"
/>
<
link
href
=
"../Styles/kendo.metro.min.css"
type
=
"text/css"
rel
=
"stylesheet"
/>
<
script
src
=
"../Scripts/jquery-1.7.1.min.js"
type
=
"text/javascript"
></
script
>
<
script
src
=
"../Scripts/kendo.all.min.js"
type
=
"text/javascript"
></
script
>
</
head
>
<
body
>
<
div
>
<
script
type
=
"text/javascript"
>
$(document).ready(function () {
var window = $("#window");
$("#openwindow").click(function () {
window.data("kendoWindow").open().center();
});
if (!window.data("kendoWindow")) {
window.kendoWindow({
content: "selectcontact.htm",
title: "Select a Contact",
actions: ["Refresh", "Close"],
visible: false,
modal: true,
close: onClose
});
}
function onClose(e) {
$("#selectedcontacts option").each(function() {
$("#returnedcontacts")
.append("<
option
></
option
>")
.prop("value", $(this).val())
.text($(this).text());
});}
});
</
script
>
<
p
id
=
"window"
></
p
>
<
button
id
=
"openwindow"
class
=
"k-button"
>Open Window</
button
>
<
br
/>
<
select
id
=
"returnedcontacts"
multiple
=
"multiple"
></
select
>
</
div
>
</
body
>
</
html
>
Any idea why the code in my onClose event isn't doing anything?