I found the solution.
var dropDown = $("#ddList").data("kendoDropDownList");
var ddData = dropDown.dataSource.view()[dropDown.selectedIndex - 1];
ddData contains all the JSON of the selected item in the drop Down.
Question
At the moment I can only store 'dataTextField' and 'dataValueField' to a Kendo DropDown list, but I need to be able to store more values for each item in the list.
I populate the Drop downs with JSON data, the JSON array contains multiple properties for each index in the array.
Is there a way to add more values for drop down items (e.g. 'dataCustomField1', 'dataCustomField2', 'dataCustomField3')
La solution
I found the solution.
var dropDown = $("#ddList").data("kendoDropDownList");
var ddData = dropDown.dataSource.view()[dropDown.selectedIndex - 1];
ddData contains all the JSON of the selected item in the drop Down.
Autres conseils
I know the above selected answer works but the value you're looking for is already given to you when item is selected in the drop list as below
$('#drop-list').kendoDropDownList({
dataSource: [{ID: 1, NAME: 'A', dataCustomField1: 'data'}...],
dataTextField: "NAME",
dataValueField: "ID",
change: function(e) {
var myJsonItem = this.dataItem(); // <---- Here is your json item
console.log(myJsonItem.dataCustomField1); // <---- Sample usage
}
});