I am trying to add a item to the kendoDropDownList, it seems to add the option but not set the value and text. Inspecting the select it just adds a new option
<option></option>
Here is what I am using
$("#nameList").data("kendoDropDownList")
.dataSource.add({ "text": "Joe", "value": "Joe" });
UPDATE
Here is my datasource model and the requestEnd
as suggested but the values seem to get messed up
datasource_people = new kendo.data.DataSource({
type: "json",
serverFiltering: true,
transport: {
read: {
dataType: 'json',
type: 'GET',
url: '/restful/people/'
}
},
filter: {
field: "status",
operator: "eq",
value: 1
},
schema: {
data: function(response) {
return response.data.plaintiffs;
},
model: {
id: "person_id",
fields: {
person_id: {type: "number"},
name: { type: "string"}
}
},
errors: "error",
total: function(response) {
return response.data.total;
}
}
});
Then Later
$("#people_list").kendoDropDownList({
dataTextField: "text",
dataValueField: "value",
dataSource: {
datasource_people,
requestEnd: function (e) {
e.response.push({text: "John", value: "John"});
}
}
});