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

Dynamically created combobox issues

0 Answers 142 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Devon
Top achievements
Rank 1
Devon asked on 13 Aug 2012, 12:24 PM
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:

<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);
        }

No answers yet. Maybe you can help?

Tags
General Discussions
Asked by
Devon
Top achievements
Rank 1
Share this question
or