Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Nick Armitage on Oct 27, 2008 08:54
open dhtmlx forum
dhtmlxCombo - single data source

I am using a dhtmlxCombo control many times on a page (it holds names).
I have multiple combos on the page and they all need to hold the same set of names from which the user can select one.
The way I have implemented it works but it is not terribly efficient for I have defined a combo for each control and pointed to the same XML file.
Is there a way of specifying that the control is a dhtmlxCombo and that the source of the information comes from an XML file but the data for the XML file is only stored once on the page.
Currently, I have 27 combos on the page and it takes ages to load the page because as far as I can tell, it is loading the data from the XML file 27 times!!
There must be a better way to do this so some guidance would be appreciated.
Answer posted on Oct 27, 2008 09:45
Different instances of combo doesn't share xml cache, so it highly possible that each instance load the xml file again. 
You can workaround problem as

dhtmlxAjax.get("data.php",function(response){
       var combo1 = new ...
       combo1.loadXMLString(response.xmlDoc.responseText);
       var combo2 = new ...
       combo2.loadXMLString(response.xmlDoc.responseText);
       ...
})

as result data will be loaded only once, and shared between all combos