Skip to main content

load

Description

Loads data to the gantt from an external data source

load: (url: string, type?: string, callback?: GanttCallback) => any

Parameters

  • url - (required) string - the server-side url (may be a static file or a server side script that outputs data)
  • type - (optionaL) string ('json', 'xml', 'oldxml') - the data type. The default value - 'json'
  • callback - (optionaL) function - the callback function

Returns

  • resultPromise - (object) - the promise object which resolves when ajax request is completed

Example

gantt.load("/data",function(){
gantt.message("everything is ready");
});
//or
gantt.load("/data").then(function(xhr){
gantt.message("everything is ready");
});
//or
gantt.load("data.json"); //loading data in the JSON format
//or
gantt.load("data.xml","xml"); //loading data in the XML format (version 2.0+)
//or
gantt.load("data.xml","xml", function(){ //specifying the callback function
alert("Data has been successfully loaded");
});

Details

The method invokes the onLoadStart and onLoadEnd events.

note

Note that the method doesn't work in the Gantt version for Node.js.