Hello.
I have a server that respond to my ajax request with this format:
[ item1 , item2 , item3 ... ]
And I need to populate combobox.
So use this onLoadSuccess method:
<input class="easyui-combobox" name="domain" id="domain" style="width:90%;"
data-options="
url:'/webapp/services/serviceX',
method:'get',
valueField:'id',
textField:'text',
panelHeight:'auto',
onLoadSuccess: function() {
let res=[];
data=$('#domain').combobox('getData');
if( typeof(data[0].id)!=='undefined' ) return; // to avoid infinite onLoadSuccess recursion
for(n=0;n<data.length;n++) { res.push( { 'id': n, 'text': data[n] }); }
$('#domain').combobox('loadData',res);
}
">
But seems too dirty. What's the right way to do this task?
Thanks in advance.
Juan Antonio