Hi everyone.
I have an issue with some comboboxes which I create dynamically inside a template for a listview.
I need to be able to get the value of the combobox when a button is clicked and use that value to update my datasource. My problem is that I cannot isolate the combobox in order to get the data.
Can someone please have a look at my code and give me some ideas??
Template:
I have no problem getting the dataItem from the button click (var button = e.button). Is there no way to get the combobox in a similar fashion? (var combo = e.comboBox)? I have tried everything I can think of and nothing seems to be working.
Button Click: (This must get the combobox value/text)
I have an issue with some comboboxes which I create dynamically inside a template for a listview.
I need to be able to get the value of the combobox when a button is clicked and use that value to update my datasource. My problem is that I cannot isolate the combobox in order to get the data.
Can someone please have a look at my code and give me some ideas??
Template:
<
script
type
=
"text/x-kendo-template"
id
=
"packagesTemplate"
>
<
h3
class
=
"item-title"
>${Name}</
h3
>
<
p
class
=
"item-info"
>Status: ${Status}</
p
>
<
select
data-role
=
"comboBox"
id
=
"select#:id#"
>
<
option
value
=
"Pending"
>Pending</
option
>
<
option
value
=
"Delivered"
>Delivered</
option
>
<
option
value
=
"Damaged"
>Damaged</
option
>
<
option
value
=
"Refused"
>Refused</
option
>
</
select
>
<
a
data-role
=
"button"
data-item-id
=
"#:id#"
data-click
=
"saveChanges"
class
=
"details-link"
>Save Changes</
a
>
I have no problem getting the dataItem from the button click (var button = e.button). Is there no way to get the combobox in a similar fashion? (var combo = e.comboBox)? I have tried everything I can think of and nothing seems to be working.
Button Click: (This must get the combobox value/text)
function saveChanges(e) {
var button = e.button,
item = packageDataSource.get(button.data("itemId"));
console.log(item);
}