default value in dropdownlist

1 Answer 8085 Views
DropDownList
Sebastian
Top achievements
Rank 1
Sebastian asked on 03 May 2021, 11:29 AM

I have this

$('<input data-bind="value:' + options.field + '"/>')
.appendTo(container)
.kendoDropDownList({
suggest: true,
select: function(e) {
personSource.setDirty();
},
dataSource: rows,
});

////////////////

whenever I load the page the dropdownlist is not automatically filled with the first value of the list (default value).
I have to click the mouse or do something and it gets filled.

if I put it like this

alert('hello');
$('<input data-bind="value:' + options.field + '"/>')
.appendTo(container)
.kendoDropDownList({
suggest: true,
select: function(e) {
personSource.setDirty();
},
dataSource: rows,
});

after I click the alert the default value is filled.

How can I make it fill the default without needing a popup?

1 Answer, 1 is accepted

Sort by
0
Misho
Telerik team
answered on 06 May 2021, 07:08 AM

Hello,

The default value of the dropdownlist could be set by index or value. Here is a dojo sample showing both approaches:

https://dojo.telerik.com/OxiLAGaP/5 

I hope this helps.

Best Regards,
Misho
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
DropDownList
Asked by
Sebastian
Top achievements
Rank 1
Answers by
Misho
Telerik team
Share this question
or