Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Nerea on Nov 27, 2008 01:23
open dhtmlx forum
setComboValue()

I load a combobox from a xml file.

Later I wan't to select an option using setComboValue() instruccion.
But this shows in text of the combo the value I wan't to attach to the option, It doesn't select the option.
is there another instrucction to do it?

<div id="cmb_Pago" class = "div_combo" style="width:320px; height:30px;"></div>
    <script>
        var z=new dhtmlXCombo("cmb_Pago","alfa2",320);    
        z.enableFilteringMode(true,"buscarForPago.php",true);    

    </script>

z.setComboValue("10");

Thanks a lot!
Answer posted by Support on Nov 27, 2008 02:05
>>I load a combobox from a xml file.
Problem can be caused by async. way of data loading. 
The combo require some time after loadXML call, to load list of options, so if you will call setComboValue immideatly after loadXML - the data still will not be available and necessary value will not be selected. 

You can use second parameter of loadXML to catch the moment, when data available for selection. 
           z.loadXML(some,function(){ 
                  z.setComboValue("10");
           });