EasyUI Forum
December 06, 2025, 05:47:08 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
  Home Help Search Login Register  
  Show Posts
Pages: [1]
1  General Category / EasyUI for jQuery / ComboBox changes using select on: November 26, 2013, 03:26:20 AM
Hi,

I am trying to figure out how to update/append  the contents/options of easyui-combobox using javascript after fetching json data from server.

my script inside the .html

var xmlhttp = getRequestObject();
            xmlhttp.onreadystatechange = function()
            {
                 if ((xmlhttp.readyState === 4) && (xmlhttp.status === 200)) {
                    try {
                        var xmlDocument = xmlhttp.responseText;
                        var dpanel = document.getElementById("reportdate");
                        if(xmlDocument !== null) {
                            var valJS = JSON.parse(xmlDocument.toString());
                            var output = "";
                            $.each(valJS, function(key, obj) {
                                output += '<option value="'+ obj +'">'+ obj +'</option>';
                                });
                            dpanel.innerHTML=output;
                        }
                    }
                    catch (err) {
                        alert("error=" + err.message);
                    }
                }
            };

the html code is as follows

 <div id="datepanel">
           
            <select  name="reportdate" id="reportdate" style="width:200px;" class="easyui-combobox">
            </select>

 </div>

With the above code once the page is loaded, i am able to see <options> inside the select updated, but the same is not reflected in the combobox[ie the combo is empty].
On the other hand, if i remove the class="easyui-combobox", the the options are visible on the page.

I dont know what i am doing wrong. Any help would be greatly appreciated.


Pages: [1]
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!