Search code examples
propertieskendo-uistorekendo-dropdown

KendoUI DropDown list - Add custom data fields


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')


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.