Populate combo into form using xml ajax call


#1

Hi, using dhtmlx 4.5 i can set my combo option with result of xml ajax call

i.e
myForm.getCombo(“PCSoc”).clearAll();
var dSoc = window.dhx4.ajax.postSync(“ajax_combo_soc”,“PCUsr=”+myForm.getItemValue(“PCUsr”));
var dataSoc = dSoc.xmlDoc.responseText;
myForm.getCombo(“PCSoc”).load(dataSoc);

I would like to migrate to new Suite…how can I do it?

Thanks in advance,
Chiara


#2

Hello, Please, refer to the following page:
https://docs.dhtmlx.com/suite/form__combo.html#workingwithcombo
According to it:

myForm.getCombo(“PCSoc”).clearAll();

will be:

form.getItem("PCSoc").getWidget().removeAll()

there is no possibility to load the data to combo from xml in new dhtmlxSuite. Only the JSON is supported.
And you need to call the

var combo=form.getItem("PCSoc").getWidget().data.parse(dataSoc)

to populate the options to the combo.
Here You can find a working example:
https://snippet.dhtmlx.com/9tnpaoce