mygrid = new dhtmlXGridObject('gridbox');
mygrid.setImagePath("../../codebase/imgs/");
mygrid.setHeader("Name,Date of Birth, First Book Published");
mygrid.setInitWidths("*,100,100");
mygrid.setColAlign("left,center,center");
mygrid.setColTypes("ed,dhxCalendar,dhxCalendarA");
mygrid.setColSorting("str,date,date");
mygrid.setSkin("dhx_skyblue");
mygrid.init();
mygrid.loadXML("../common/grid_dates.xml");这是dhtmlx js库中的gird,它的loadXML能加载本地xml,也能加载服务器端的xml;JS怎么加载本地xml的?它这个加载服务器xml是通过发ajax请求吗,还是别的?
mygrid.setImagePath("../../codebase/imgs/");
mygrid.setHeader("Name,Date of Birth, First Book Published");
mygrid.setInitWidths("*,100,100");
mygrid.setColAlign("left,center,center");
mygrid.setColTypes("ed,dhxCalendar,dhxCalendarA");
mygrid.setColSorting("str,date,date");
mygrid.setSkin("dhx_skyblue");
mygrid.init();
mygrid.loadXML("../common/grid_dates.xml");这是dhtmlx js库中的gird,它的loadXML能加载本地xml,也能加载服务器端的xml;JS怎么加载本地xml的?它这个加载服务器xml是通过发ajax请求吗,还是别的?
你看下源代码不就得了
/**
* @desc: load XML
* @type: private
* @param: filePath - xml file path
* @param: postMode - send POST request
* @param: postVars - list of vars for post request
* @topic: 0
*/
dtmlXMLLoaderObject.prototype.loadXML=function(filePath, postMode, postVars, rpc){
if (this.rSeed)
filePath+=((filePath.indexOf("?") != -1) ? "&" : "?")+"a_dhx_rSeed="+(new Date()).valueOf();
this.filePath=filePath; if ((!_isIE)&&(window.XMLHttpRequest))
this.xmlDoc=new XMLHttpRequest();
else {
if (document.implementation&&document.implementation.createDocument){
this.xmlDoc=document.implementation.createDocument("", "", null);
this.xmlDoc.onload=new this.waitLoadFunction(this);
this.xmlDoc.load(filePath);
return;
} else
this.xmlDoc=new ActiveXObject("Microsoft.XMLHTTP");
} if (this.async)
this.xmlDoc.onreadystatechange=new this.waitLoadFunction(this);
this.xmlDoc.open(postMode ? "POST" : "GET", filePath, this.async); if (rpc){
this.xmlDoc.setRequestHeader("User-Agent", "dhtmlxRPC v0.1 ("+navigator.userAgent+")");
this.xmlDoc.setRequestHeader("Content-type", "text/xml");
} else if (postMode)
this.xmlDoc.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
this.xmlDoc.setRequestHeader("X-Requested-With","XMLHttpRequest");
this.xmlDoc.send(null||postVars); if (!this.async)
(new this.waitLoadFunction(this))();
};
兄弟,你这代码能否解释下的。
我只能理解向服务器发个ajax请求。