I want for each item to bring data from server then create a combo box containing this data. What is going on now is I got 3 combo boxes with same data.
I have this code:
self.CollectionTest.each(function(item, index) {
if (item.attributes.QuesAnswerType == 7) {
self.dtype = item.attributes.QuesAnswerValue_Para;
self.dropdowncollection = new QuestionaireDetailsCollection;
self.dropdowncollection.fetch({
reset: true,
url: 'api/Variables/getPara',
data: $.param({ type: self.dtype }),
success: function() {
self.dropdowndataSource = new kendo.Backbone.DataSource({
collection: self.dropdowncollection,
});
var cbid = "cb" + item.attributes.Id;
$('<input id="' + cbid + '" dataTextField: "Name" dataValueField: "Id" data-bind="value:QuesDetAnswer"/>')
.appendTo("#divrb" + item.attributes.Id)
.kendoDropDownList({
dataTextField: "Name",
dataValueField: "Id",
dataSource: self.dropdowndataSource,
autoBind: true,
});
} // end of success
});