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

Load On Demand with prefilled values

1 Answer 56 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Simon
Top achievements
Rank 1
Simon asked on 23 Mar 2009, 05:26 PM
I'm using RadComboBox with EnableLoadOnDemand=True to implement custom server side filtering and it works fine. Initially, I'm prefilling the text area of some combos with SelectedValue property.

I'd like to detect when the user expands the combo with the arrow icon to show the complete content (doing no filtering). Here's an example.

Let's say I got a data list A, B, C, D, E, F. The combo is prefilled with SelectedValue=A. When the user expands the dropitem, the 

RadComboBoxItemsRequestedEventArgs.Text property in the ItemRequested handler will contain A and my custom filtering code will filter based on that text. In my case, it will show only A due to the exact match.

I'd like to know if the user just expanded the combo to avoid filtering; the combo would show A,B,C,D,E,F. Otherwise, I'm going to display only A. When the combo is expanded, it will be ok to filter the content as the user types in text.

How can I do that ?

1 Answer, 1 is accepted

Sort by
0
Simon
Telerik team
answered on 26 Mar 2009, 12:34 PM
Hello Simon,

You could stop Item requests if they are initiated by the ComboBox in response to the opening of the drop down to achieve your goal.

Simply handle the events as shown below to keep track of the state of the drop down and cancel the Items request when needed:

var dropDownIsOpening = false
 
function onDropDownOpening(sender, eventArgs) { 
    dropDownIsOpening = true;     
 
function onItemsRequesting(sender, eventArgs) { 
    eventArgs.set_cancel(dropDownIsOpening);   
 
function onDropDownOpened(sender, eventArgs) { 
    dropDownIsOpening = false;     

Sincerely yours,
Simon
the Telerik team

Check out Telerik Trainer , the state of the art learning tool for Telerik products.
Tags
ComboBox
Asked by
Simon
Top achievements
Rank 1
Answers by
Simon
Telerik team
Share this question
or