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

Keep Item selected and still list all items inside combobox when dropdown opened

1 Answer 39 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Carina
Top achievements
Rank 1
Carina asked on 21 May 2013, 06:12 PM
Hi,

I have a combobox that when it has an item selected I want to go back and select the down arrow and bring up the list of the items in the combobox but keep the selected item until I select a new one. I managed to do it, but I am not sure why it when I first select the combobox dow arrow it brings up only that one item selected and when I click on the down arrow again it does bring up the full list. Please see the attached image to what is goign on. Here is my javascript and aspx:

<telerik:radcombobox ID="cboDocs" runat="server"  MarkFirstMatch="False" EnableAutomaticLoadOnDemand="True" ShowMoreResultsBox="true" EnableVirtualScrolling="true"
                    DataSourceID="ObjDataSourc" Width="200px"  EmptyMessage="Select Document" DataTextField="DocName" 
                    OnClientDropDownOpening="dropDownOpening" ToolTip="Select an existing document type to review."
                    DataValueField="DocID"  ItemsPerRequest="12"  Skin="Office2010Blue" AutoPostBack="true"> 

<
function dropDownOpening(sender, args) {
               if (sender.get_text() != "") {
                   sender.set_text(sender.get_text());
                   sender._filterText = "NotIsEmpty";
                   sender.requestItems("");
                   sender.get_items("");
               }
           }
>

1 Answer, 1 is accepted

Sort by
0
Plamen
Telerik team
answered on 24 May 2013, 11:43 AM
Hi Carina,

 
Thank you for contacting Telerik support.

This issue is observed because the loaded items are generated according to the selected item. Here is the code that worked around this issue at my side:

function dropDownOpening(sender, args) {
              var selectedText = sender.get_text();
              if (selectedText != "") {
                  sender.set_text("");
              }
              setTimeout(function myfunction() {
                  sender.set_text(selectedText);
              }, 20);
          }


Hope this will be helpful. If you have further questions please don't hesitate to contact us again.

Regards,
Plamen
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
ComboBox
Asked by
Carina
Top achievements
Rank 1
Answers by
Plamen
Telerik team
Share this question
or