Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by ni on Jan 14, 2009 02:58
open dhtmlx forum
Combobox:when text was deleted

Hello.

I am using ComboBox for a web page.
If I could, I would like to change it to work like below:


1.When the page is loaded, it loads the xml file(reading from database), and drop down is available
2.when typed in the combo box, it searches for the value in the table
3.When deleted the value once he or she entered, the whole data comes back on the drop down

At the moment 1 and 2 is ok but 3 doesn't work.
-----------------------------------------------------------------------------------------------------------------------------------------------
The code goes like that:
    var z2=new dhtmlXCombo(\"softwareidcon\",\"softwareid\",300);         
    z2.loadXML(\"autosuggestxmllist.php?op=softwarexml\", true, true);
    z2.enableFilteringMode(true, \"autosuggestxmllist.php?op=softwarexml&mask=TEXT\", true, true);
:
:

<div id=\"softwareidcon\"></div>
-----------------------------------------------------------------------------------------------------------------------------------------------


Do you have any suggestions?

Answer posted by Support on Jan 14, 2009 04:10
Can be achieved by code modification

dhtmlXCombo.prototype._fetchOptions=function(ind,text){
  if (text=="") { this.closeAll(); return this.clearAll(); }

can be changed as

dhtmlXCombo.prototype._fetchOptions=function(ind,text){
  if (text=="") return this.loadXML("autosuggestxmllist.php?op=softwarexml");

In such case, each time when value cleared - full list of options will be shown ( because of caching , xml value will be requested only first time, and all further times it will be taken from cache )