Class links.DataConnector
Defined in: treegrid.js.
Constructor Attributes | Constructor Name and Description |
---|---|
links.DataConnector(options)
|
Method Attributes | Method Name and Description |
---|---|
addEventListener(callback)
Add an event listener to the DataConnector
|
|
appendItems(items, callback, errback)
Asynchronously append a number of items.
|
|
getChanges(index, num, items, callback, errback)
Asynchronously check for changes for a number of items.
|
|
getFiltering(filters)
|
|
getItems(index, num, callback, errback)
Asynchronously get a number of items by index
|
|
Get the currently set options
|
|
getSorting(sorting)
|
|
insertItemsBefore(items, beforeItem, callback, errback)
Asynchronously insert a number of items.
|
|
linkItems(sourceItems, targetItem, callback, errback)
Asynchronously link a source item to a target item.
|
|
moveItems(items, beforeItem, callback, errback)
Asynchronously move a number of items.
|
|
onEvent(event)
onEvent handler
|
|
removeEventListener(callback)
Remove an event listener from the DataConnector
|
|
removeItems(items, callback, errback)
Asynchronously remove a number of items.
|
|
setActions(actions)
Set action icons
|
|
setFiltering(filters)
|
|
setOptions(options)
Set options for the dataconnector
|
|
setSorting(sorting)
|
|
trigger(event, params)
Trigger an event
|
|
updateItems(items, callback, errback)
Asynchronously update a number of items.
|
Method Detail
addEventListener(callback)
Add an event listener to the DataConnector
- Parameters:
- {function} callback
- The callback method will be called with two parameters: {String} event {Object} params
appendItems(items, callback, errback)
Asynchronously append a number of items.
The callback returns the appended items, which may be newly instantiated objects .
- Parameters:
- {Object[]} items
- A list with items to be added
- {function} callback
- Callback method called on success. Called with one object as parameter, containing fields: {Number} totalItems {Array with Objects} items The appended items
- {function} errback
- Callback method called on failure. Called with an error message as parameter.
getChanges(index, num, items, callback, errback)
Asynchronously check for changes for a number of items.
The method will return the items which are changed.
The changed items can be updated via the method getItems.
- Parameters:
- {Number} index
- Index of the first item to be checked
- {Number} num
- Number of items to be checked
- {Object[]} items
- A list with the current versions of these items
- {function} callback
- Callback method called on success. Called with one object as parameter, containing fields: {Number} totalItems {Array with Objects} items The changed items
- {function} errback
- Callback method called on failure. Called with an error message as parameter.
getFiltering(filters)
- Parameters:
- filters
getItems(index, num, callback, errback)
Asynchronously get a number of items by index
- Parameters:
- {Number} index
- Index of the first item to be retrieved
- {Number} num
- Number of items to be retrieved
- {function} callback
- Callback method called on success. Called with one object as parameter, containing fields: {Number} totalItems {Array with Objects} items
- {function} errback
- Callback method called on failure. Called with an error message as parameter.
getOptions()
Get the currently set options
getSorting(sorting)
- Parameters:
- sorting
insertItemsBefore(items, beforeItem, callback, errback)
Asynchronously insert a number of items.
The callback returns the inserted items, which may be newly instantiated objects .
- Parameters:
- {Object[]} items
- A list with items to be inserted
- {Object} beforeItem Optional
- The items will be inserted before this item. When beforeItem is undefined, the items will be moved to the end of the data.
- {function} callback
- Callback method called on success. Called with one object as parameter, containing fields: {Number} totalItems {Array with Objects} items The inserted items
- {function} errback
- Callback method called on failure. Called with an error message as parameter.
linkItems(sourceItems, targetItem, callback, errback)
Asynchronously link a source item to a target item.
The callback returns the linked items.
- Parameters:
- {Object[]} sourceItems
- {Object} targetItem
- {function} callback
- Callback method called on success. Called with one object as parameter, containing fields: {Number} totalItems {Array with Objects} items The removed items
- {function} errback
- Callback method called on failure. Called with an error message as parameter.
moveItems(items, beforeItem, callback, errback)
Asynchronously move a number of items.
The callback returns the moved items, which may be newly instantiated objects .
- Parameters:
- {Object[]} items
- A list with items to be moved
- {Object} beforeItem Optional
- The items will be inserted before this item. When beforeItem is undefined, the items will be moved to the end of the data.
- {function} callback
- Callback method called on success. Called with one object as parameter, containing fields: {Number} totalItems {Array with Objects} items The moved items
- {function} errback
- Callback method called on failure. Called with an error message as parameter.
onEvent(event)
onEvent handler
- Parameters:
- {String} event
- {Object} params.
- Object containing index (Number), and item (Object).
removeEventListener(callback)
Remove an event listener from the DataConnector
- Parameters:
- {function} callback
- The registered callback method
removeItems(items, callback, errback)
Asynchronously remove a number of items.
The callback returns the removed items.
- Parameters:
- {Object[]} items
- A list with items to be removed
- {function} callback
- Callback method called on success. Called with one object as parameter, containing fields: {Number} totalItems {Array with Objects} items The removed items
- {function} errback
- Callback method called on failure. Called with an error message as parameter.
setActions(actions)
Set action icons
- Parameters:
- {Array} actions
setFiltering(filters)
- Parameters:
- filters
setOptions(options)
Set options for the dataconnector
- Parameters:
- {Object} options
- Available options: 'columns': An array containing objects, each object contains parameters 'name', and optionally 'text' and 'title'. The provided fields will be displayed in the given order. 'dataTransfer': An object containing the parameters: 'allowedEffect': A string value 'none', 'link', 'move', or 'copy' 'dropEffect': A string value 'none', 'link', 'move', or 'copy
setSorting(sorting)
- Parameters:
- sorting
trigger(event, params)
Trigger an event
- Parameters:
- {String} event
- {Object} params
updateItems(items, callback, errback)
Asynchronously update a number of items.
The callback returns the updated items, which may be newly instantiated objects .
- Parameters:
- {Object[]} items
- A list with items to be updated
- {function} callback
- Callback method called on success. Called with one object as parameter, containing fields: {Number} totalItems {Array with Objects} items The updated items
- {function} errback
- Callback method called on failure. Called with an error message as parameter.