Home Reference Source
import LoadOnDemandSettings from 'd3-mitch-tree/js/LoadOnDemandSettings.js'
public class | source

LoadOnDemandSettings

Constructor Summary

Public Constructor
public

constructor(ownerObject: object, options: object)

Member Summary

Private Members
private
private
private

Method Summary

Public Methods
public

Gets the owner object.

public

hasChildren(dataItem: object): boolean

Returns a boolean indicating whether the passed data item has children.

public

Returns a boolean indicating whether load-on-demand is enabled or not.

public

loadChildren(data: *, processData: *): *

Load the children for a given data object.

public

setHasChildrenMethod(newHasChildrenMethod: hasChildrenCallBack): object

Sets the hasChildren callback function, used to determine whether a node or data item has children or not.

public

setLoadChildrenMethod(newLoadChildrenMethod: loadChildrenCallBack): object

Sets the loadChildren callback function, used to load children data items for a node.

public

Validates whether the provided settings are correct or not.

Public Constructors

public constructor(ownerObject: object, options: object) source

Params:

NameTypeAttributeDescription
ownerObject object

The owner object.

options object

The options object.

options.hasChildren hasChildrenCallBack

Sets the hasChildren callback function, used to determine whether a node or data item has children or not.

options.loadChildren loadChildrenCallBack

the loadChildren callback function, used to load children data items for a node.

Private Members

private _hasChildren: * source

private _loadChildren: * source

private _ownerObject: * source

Public Methods

public back(): object source

Gets the owner object.

Return:

object

The owner object.

public hasChildren(dataItem: object): boolean source

Returns a boolean indicating whether the passed data item has children.

Params:

NameTypeAttributeDescription
dataItem object

The data item to check if it has children or not.

Return:

boolean

Whether the data item has children or not.

public isEnabled(): boolean source

Returns a boolean indicating whether load-on-demand is enabled or not.

Return:

boolean

Whether load-on-demand is enabled or not.

public loadChildren(data: *, processData: *): * source

Load the children for a given data object.

Params:

NameTypeAttributeDescription
data *

The data item, which should be used to load the children of the data item via AJAX.

processData *

Callback function to process the children data items.

Return:

*

public setHasChildrenMethod(newHasChildrenMethod: hasChildrenCallBack): object source

Sets the hasChildren callback function, used to determine whether a node or data item has children or not.

Params:

NameTypeAttributeDescription
newHasChildrenMethod hasChildrenCallBack

Return:

object

The tree object.

public setLoadChildrenMethod(newLoadChildrenMethod: loadChildrenCallBack): object source

Sets the loadChildren callback function, used to load children data items for a node.

Params:

NameTypeAttributeDescription
newLoadChildrenMethod loadChildrenCallBack

Return:

object

The tree object.

public validateSettings(): object source

Validates whether the provided settings are correct or not.

Return:

object

The tree object.