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

Showing first item in DropDownList

3 Answers 245 Views
DropDownList
This is a migrated thread and some comments may be shown as answers.
Alex
Top achievements
Rank 1
Alex asked on 10 Jun 2015, 03:02 PM

Hi

I cascade three DropDownLists 'manually'. I don't use the built in cascadeFrom mechanism but I read the dataSource of the child DropDown within the change event of its parent. I do this because I attach a more complicated filter.

This works fine so far, the dataSource is read, data is returned correctly and can be selected in the child DropDown - BUT - I would like the first item of the data to be selected immediately after reading the DataSource. Unfortunately, the child DropDown initially only shows an empty item after loading the new data although, there isn't an empty item defined.

How can I force the child DropDown to show the first item after reading the remote data?

 

Regards

 

Alex

3 Answers, 1 is accepted

Sort by
0
Alexander Valchev
Telerik team
answered on 12 Jun 2015, 11:07 AM
Hi Alex,

If there is no option label or empty item the DropDownList should select first item. You may observe the behavior in this demo page. How your DropDownList configuration differs from the one presented in the demo?

Looking forward to your reply.

Regards,
Alexander Valchev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Alex
Top achievements
Rank 1
answered on 12 Jun 2015, 12:04 PM

Hi

thanks for your reply.
I prepared an example showing the issue:

http://www.improbabilitydrive.ch/swissbryophytes/app/src/view/taxon/dropdown.php

1) The data loads correctly into the first dropdown and its first item is shown as expected.
2) Now select an item from the first dropdown -> data is loaded correctly into the second dropdown and its first item is shown as expected.
3) Now select another item from the first dropdown -> again data is loaded correctly into the second dropdown but it doesn't automatically show the first item although I don't load an empty item.

Regards

 

Alex

0
Georgi Krustev
Telerik team
answered on 16 Jun 2015, 11:43 AM
Hello Alex,

The described behavior is expected as we enabled item de-selection since Q1 2015 (more information here). The result of this functionality is that the widget now does not select first item on every data source reload. It will show the first item only the first item. On any subsequent manual rebind (like the dataSource.read() call), the developer is responsible for the item selection. In your case, you can wire the dataBound event and select the first item explicitly.

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