creates a datastore according to the provided configuration

datastore & treedatastore createDatastore(object config);
configobjecta configuration object of a datastore
datastore & treedatastorethe datastore or treedatastore object depending on the type


var resourcesStore = gantt.createDatastore({
    initItem: function(item){ = item.key || gantt.uid();
        return item;

Related samples


Configuration object properties:

  • name - (string) an arbitrary string name of the datastore. The datastore can be accessed by its name using getDatastore.
  • initItem - (function) optional, preprocesses items loaded into datastore. It is a good place to set the default values of the datastore items.
  • type - (string) optional, accepts only one fixed value "treeDatastore". If the type:"treeDatastore" is specified, the datastore will support hierarchical data, with the id property as a primary key, and parent as a link to the parent id. Any other value will produce a flat list datastore.
  • fetchTasks - (boolean) enables showing all tasks assigned to a certain resource in the resource view panel. This functionality works both for the resource diagram and resource histogram types of layout.
See also
Back to top