Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Greg Simmons on Feb 15, 2008 11:42
open dhtmlx forum
Is there any way to add a blank option to a filtered dhtmlx combo box

I like the dhtmlx combo box.
One of the requests we've had is to include a blank option so that users can clear the current value by selecting it.
We are using the dhtmlx combo box with dynamic filtering so when a value is already populated the dropdown list only shows one value, the selected one. To clear the value the user has to manually clear it. Is it possible to include a blank selection value in the combo box even if a value is selected while dynamic filtering is enabled?

Thanks,
Greg Simmons
Answer posted by Support on Feb 18, 2008 08:11
In case of dynamic filtering only data which match entered text will be shown in list of options, but you can modify code in next way

for(var i=0; i<this.optionsArr.length; i++){
           var z=filter.test(this.optionsArr[i].text)||(this.optionsArr[i].text=="");

added code will always show option with empty text ( if it was loaded in combo, of course ) actually it can be changed to any custom value here