load

从外部源加载数据到甘特图中。

object load(string url, [string type,function callback] );
urlstring服务器端的URL(可以是静态文件或返回数据的服务器端脚本)。
typestring('json', 'xml', 'oldxml') 数据格式。默认值为 'json'
callbackfunction加载完成后调用的函数。
object一个在AJAX请求完成时解析的promise对象。

Example

gantt.load("/data",function(){
    gantt.message("everything is ready");
});
//或者
gantt.load("/data").then(function(xhr){
    gantt.message("everything is ready");
});
//或者
gantt.load("data.json"); //加载JSON格式的数据
//或者
gantt.load("data.xml","xml"); //加载XML格式的数据(版本2.0及以上)
//或者
gantt.load("data.xml","xml", function(){ //提供回调函数 
    alert("数据已成功加载");
});

Related samples

Details

此方法会触发 onLoadStartonLoadEnd 事件。

请注意,该方法不支持Node.js版本的甘特图。

See also
Back to top