I am using the Kendo UI dropdown in the watchlist
<ul data-role="listview" id="participants-listview" data-style="inset" data-template="participants-listview-template" data-bind="source: participants, events { click: onSelectParticipant }" /> <script type="text/x-kendo-template" id="listview-template"> <div> <span>#:RoleDesc#</span> <span> <select data-role="dropdownlist" id="status-id" data-text-field="StatusDesc" data-value-field="StatusId" data-bind="value: StatusId, source: participantStatuses, events: { change: onParticipantStatusChange }" name="Status" required="required" validationMessage="required"> </select> </span> </div> </script>
viewModel
viewModel = kendo.data.ObservableObject.extend({ dataSource: new kendo.data.DataSource({ transport: { type: "odata", read: { url: function() { return meetings/participants"; } } } }), participants: [], //listview data participantStatuses: [ // dropdownlist selection { StatusId: 1, StatusDesc: "Invited" } , { StatusId: 6, StatusDesc: "Present" }, { StatusId: 7, StatusDesc: "Absent" } ], selectedParticipant: null, showListView: function(e) { viewModel.dataSource.fetch(function(){ var data = viewModel.dataSource.data(); meetingViewModel.set("participants", data); }); },
I expect that when the page loads, the selected status ID of the participants will be captured by the drop-down list as selectedValue, binding the StatusId attribute of the StatusId participants to the drop-down list, like this data-bind="value:StatusId" . But this is strange in my case, it throws an error
Uncaught TypeError: Object
when I deleted data-bind="value:StatusId" , the error disappeared, but did not select the corresponding selected value.
Any ideas on this error?
source share