dhtmlXCombo - problem with default in enableFilteringMode

I am creating a dhtmlXComb using the following model:

	locationJs = new dhtmlXCombo("location_zone", "location",250);

The SOURCE_LINK is returning an xml (is created by the book) like this:

London New York

Also SOURCE_LINK is getting city id and city name from the database and the id is the one I am interested in.

I am performing a search based on the city(which is my dhtmlx city dynamically loaded) and I would like to fill user search criteria with his previous search values. After search is completed, my page is reloaded and I am setting the combo to value “London” exactly as the user entered previously. In that moment the combo does not associate the text with corresponding value 1 as from the xml. Next time I press search, the seached value for city id is null and results are different.

How can I set the predefined value and text for combos which loads data dynamically ?

Thanks a lot



setComboText just sets the text into the combo header and does not select any value. setComboValue will also not do, as the options should be loaded before it is called and enableFilteringMode does not load options before typing. To force loading you may call filterSelf() method.

here is the solution:

/*selects the first loaded option*/ var h = locationJs.attachEvent("onXLE",function(){ this.detachEvent(h); this.selectOption(0); }); /*setting text and loading suggestions for it*/ locationJs.setComboText("London"); locationJs.filterSelf(); locationJs.closeAll();