Categories | Question details Back To List | ||
loading XML in a Grid using AJAX Hi, I think I am doing something wrong here. I want to fill a DHTMLX Grid with an XML so I use AJAX to load the XML via GET and after that I store the plain XML as a string and want the grid to load it: <!-- DHTMLx START --> <link rel="stylesheet" type="text/css" href="/js/dhtmlx_Rel3_81107/dhtmlxGrid/codebase/dhtmlxgrid.css" /> <script src="/js/dhtmlx_Rel3_81107/dhtmlxGrid/codebase/dhtmlxcommon.js"></script> <script src="/js/dhtmlx_Rel3_81107/dhtmlxGrid/codebase/dhtmlxgrid.js"></script> <script src="/js/dhtmlx_Rel3_81107/dhtmlxGrid/codebase/dhtmlxgridcell.js"></script> <script src="/js/dhtmlx_Rel3_81107/dhtmlxGrid/codebase/ext/dhtmlxgrid_start.js"></script> <script src="/js/dhtmlx_Rel3_81107/dhtmlxGrid/codebase/ext/dhtmlxgrid_group.js"></script> <script src="/js/dhtmlx_Rel3_81107/dhtmlxGrid/codebase/ext/dhtmlxgrid_excell_link.js"></script> <script src="/js/dhtmlx_Rel3_81107/dhtmlxGrid/codebase/ext/dhtmlxgridcell.js"></script> <script src="/js/dhtmlx_Rel3_81107/dhtmlxGrid/codebase/excells/dhtmlxgrid_excell_dec.js"></script> <!-- DHTMLx ENDE --> <script> var grid_kundeninfo; function doInitGrid(typ){ // Init var url; url = "/cgi-bin/webcrm/customer/crm_main.cgi?func=relay&s=[OS_SESSIONID]&i=1000&c=get_pers" url += "&typ=" + typ; dhtmlxAjax.get(url, getOutputResponse); }; function getOutputResponse(loader){ var xml = loader.xmlDoc.responseText.toString(); xml = xml.replace(/\r/g, ""); xml = xml.replace(/\n/g, ""); xml = xml.replace(/\t/g, ""); document.getElementById("in_xml").value = xml; grid_kundeninfo = new dhtmlXGridObject('kundeninfo_container'); grid_kundeninfo.setImagePath("/js/dhtmlx_Rel3_81107/dhtmlxGrid/codebase/imgs/"); grid_kundeninfo.preventIECaching(true); grid_kundeninfo.loadXMLString(xml); grid_kundeninfo.init(); }; function renew(){ window.setTimeout("sendRequestGet()", 100); }; </script> <input type="button" id="out_click" name="out_click" Size="10" value="get data" onClick="doInitGrid(this.form.out_typ.value)"> I am able to see the whole XML in a textarea (document.getElementById("in_xml").value = xml;) and this XML is completely correct (I am able to load it after I stored it in a file). But I get no further messages and the grid does not initialize itself. What am I doing wrong? Answer posted by Support on Oct 21, 2009 08:35 Does xml contain the header structure of grid? The code looks correct and must work if response was a correct xml with both header and data information. By the way , you can use grid.load("/cgi-bin/webcrm/customer/crm_main.cgi?func=relay&s=[OS_SESSIONID]&i=1000&c=get_pers"); it will work the same - will load data by ajax |