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

Nested ComboBox closing its container ComboBox

1 Answer 62 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Paul
Top achievements
Rank 1
Paul asked on 12 Jan 2009, 09:40 PM
I have a combo box that has some filtering controls in its header template.  Whenever I select the inner dropdown (to filter the outer dropdown's data) it closes both itself and the outer combo.  How can I prevent the parent from closing when the inner combo is closed? 

What would point me in the right direction is, can I grab the container combobox from javascript whenever the selected index is changed on the inner?  Also, could I have it do something that mimics the following?

function OnClientDropDownClosing(comboBox, eventArgs) {
    if(is inside a parent combo) {    <--  need help with this part
        eventArgs.set_cancel(true);
    }
}

 

1 Answer, 1 is accepted

Sort by
0
Paul
Top achievements
Rank 1
answered on 13 Jan 2009, 09:59 PM
After playing with it for a day, i was able to find a solution:

created the following javascript:

 

 

//used to track nested combos  
var innerClosed = true;  
 
//set flags to prevent nested combos from closing their container combos  
function OnClientDropDownOpenedNested(comboBox) {  
   innerClosed = false;   
}  
 
function OnClientDropDownClosedNested(comboBox) {  
   innerClosed = true;   
}  
 
function OnClientDropDownClosing(comboBox, eventArgs) {  
   eventArgs.set_cancel(!innerClosed);  


Then I set hooks on the inner RadComboBox controls Opened and Closed hooks to the "Nested" functions above.  The Closing function is mapped to the outer combo.

Worked like a charm.

This works in much the same way as the allowClose post, but this allows the two to be used in tandem.   

Later.

Tags
ComboBox
Asked by
Paul
Top achievements
Rank 1
Answers by
Paul
Top achievements
Rank 1
Share this question
or