Перейти к основному содержимому

load

Description

Загружает данные в gantt из внешнего источника данных

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

Parameters

  • url - (required) string - серверный URL-адрес (может быть статическим файлом или скриптом на сервере, который выводит данные)
  • type - (optional) string ('json', 'xml', 'oldxml') - тип данных. Значение по умолчанию - 'json'
  • callback - (optional) function - функция обратного вызова

Returns

  • resultPromise - (object) - объект Promise, который разрешается после завершения AJAX-запроса

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.

заметка

Обратите внимание, метод не работает в версии Gantt для Node.js.

Need help?
Got a question about the documentation? Reach out to our technical support team for help and guidance. For custom component solutions, visit the Services page.