This is a migrated thread and some comments may be shown as answers.

Dynamically populate DropDownList and make a selection based on text

1 Answer 680 Views
DropDownList
This is a migrated thread and some comments may be shown as answers.
Richard
Top achievements
Rank 1
Richard asked on 16 Jan 2013, 05:30 PM
Consider this fiddle that uses chained deferreds to 
1. obtain an initial text that should be selected (ajax)
2. populates a drop down list (kendoDropDownList)
3. select initial text in the DDL

My problem is in step 3.
Is there a method or technique for selecting an item in the DDL based on its dataTextField ?

I saw earlier posts that indicate .value() should be used, but I only have the data text (from step 1).

The fiddle now works as I expect it to.  The .search() method was used to select an item by data text.

Thanks,
Richard

1 Answer, 1 is accepted

Sort by
0
Georgi Krustev
Telerik team
answered on 18 Jan 2013, 12:04 PM
Hi,

 
You can use the select method with custom predicate. Thus you can decide which item to select depending on custom condition.

All the best,
Georgi Krustev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
DropDownList
Asked by
Richard
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
Share this question
or