0
votes

I am using angular kendo dropdownlist using below code. Here the k-data-value-field is an object. I am able to populate the list in the dropdown. My issues is if I have only element in the list then that's not automatically selected in the dropdown. It works for me if the k-data-value-field is simply an Id (int or string). The issue is while the k-data-value-field is an object.

Html code -

  <select id ='ddlselectedH2OAnalyzer' kendo-drop-down-list 

                                            k-ng-model="selectedH2OAnalyzer" 
                                            k-ng-disabled="!receiptPointSelected && !(isAllAnalyzersChecked && businessUnitSelected)"                                            
                                            k-data-text-field="'Displayname'"
                                            k-data-value-field="'analyzers'"
                                            k-data-source="analyzersItems"
                                            k-value-primitive="true"
                                            style="width: 100%"></select>
1
use k-index="1" to select the first item. In order to bind the object properly check the name of the property you want to bind to. It is case sensitive. For example if product object has ProductName then in the k-data-text-field should be ProductName.Mitul

1 Answers

0
votes

Correct me if I am wrong, my understanding you have a list of objects with nested properties?

If that is the case you need to bind like this k-data-value-field="'analyzer.YourPropertyName'"

Otherwise you cannot bind to an object. Ilona Kheyfets