Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Kumar on Apr 07, 2008 07:49
open dhtmlx forum
dhtmlXComboFromSelect: Show all options if user clicks on dropdown button

Hello Team,

I am currently using dhtmlXComboFromSelect to replace existing dropdown select boxes and works great !
With current code, once a selection is made, clicking dropdown doesn't show any values.
But, our current requirement demands to show all the options available to the user once he clicks on DropDown button(combo_select.gif) even after a selection is made.

Any custom code to handle this would be greatly appreciated.

Regads,
Kumar.
Answer posted by Support on Apr 08, 2008 02:39
>> With current code, once a selection is made, clicking dropdown doesn't show any values.

Such a behavior  is  really weird. 
As even you use the filtering mode, the selected option has to be  in the  dropdown list.

The problem can not be reconstructed locally.  Please, provide any sample to reconstruct it (to support@dhtmlx.com).
Answer posted by Matt on May 13, 2008 11:59
I am still having this issue.  I am just using the basic dhtmlXComboFromSelect with a filter.  After I type in and get the results and select a value it seems to reduce the values in the div.  Then when I click the dropdown arrow all that still appears in the dropdown box is the selected value.  Is there a way to get the entire original content of the select box in the dropdown every time it is clicked regardless of the filter criteria?
Answer posted by Support on May 14, 2008 08:28
There is no native way, when combo in filtering mode - list shows only options which contain entered text.
You can try to add next code to combo initialization, which must change behavior in necessary way.
    combo.attachEvent("onOpen",function(){
       //called when combo opened
       var text = combo.getComboText();   //save original text
       combo.setComboText("")
       combo.filterSelf();   // fill list with options
       combo.setComboText(text); // restore previous text
       return true;
    });
Answer posted on May 14, 2008 15:05
Where in the initialization should the following code go?
Answer posted by Support on May 15, 2008 05:29

In any moment after combo creation

var combo = dhtmlXComboFromSelect (...
combo.attachEvent("onOpen", ....

Answer posted on May 15, 2008 14:43
It kinda works if you take out the line.  It just leaves the select box empty if you dont reselect something.
combo.setComboText(text); // restore previous text


Answer posted by Support on May 16, 2008 01:59

With small modification of initialization code it may be changed to desired behavior.
Please check attached sample.

Attachments (1)
Answer posted on May 16, 2008 13:48
Thanks. It works great!