createDatastore
creates a datastore according to the provided configuration
datastore & treedatastore createDatastore(object config);
Parameters
config | object | a configuration object of a datastore |
Returns
datastore & treedatastore | the datastore or treedatastore object depending on the type |
Example
var resourcesStore = gantt.createDatastore({
name:"resource",
initItem: function(item){
item.id = item.key || gantt.uid();
return item;
}
});
Related samples
Details
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