私有方法

译者注:私有方法只有插件内部会调用,我们开发一般用不上,就不翻译了

jsTree core functionality


plugin (deco [, opts]

used to decorate an instance with a plugin. Used internally.

decoString the plugin to decorate with
optsObject options for the plugin
ReturnsjsTree
init (el, optons)

initialize the instance. Used internally.

elDOMElement jQuery String the element we are transforming
optionsObject options for this instance
Triggersinit.jstree loading.jstree loaded.jstree ready.jstree changed.jstree
teardown ()

part of the destroying of an instance. Used internally.

bind ()

bind all events. Used internally.

unbind ()

part of the destroying of an instance. Used internally.

trigger (ev [, data])

trigger an event. Used internally.

evString the name of the event to trigger
dataObject additional data to pass with the event
get_container_ul ()

returns the jQuery extended main UL node inside the instance container. Used internally.

ReturnsjQuery
get_string (key)

gets string replacements (localization). Used internally.

keyString
ReturnsString
_firstChild (dom)

gets the first child of a DOM node. Used internally.

domDOMElement
ReturnsDOMElement
_nextSibling (dom)

gets the next sibling of a DOM node. Used internally.

domDOMElement
ReturnsDOMElement
_previousSibling (dom)

gets the previous sibling of a DOM node. Used internally.

domDOMElement
ReturnsDOMElement
_load_nodes (nodes [, callback])

load an array of nodes (will also load unavailable nodes as soon as they appear in the structure). Used internally.

nodesarray
callbackfunction a function to be executed once loading is complete, the function is executed in the instance's scope and receives one argument - the array passed to _load_nodes
_load_node (obj [, callback])

handles the actual loading of a node. Used only internally.

objmixed
callbackfunction a function to be executed once loading is complete, the function is executed in the instance's scope and receives one argument - a boolean status
ReturnsBoolean
_node_changed (obj [, callback])

adds a node to the list of nodes to redraw. Used only internally.

objmixed
_append_html_data (obj, data)

appends HTML content to the tree. Used internally.

objmixed the node to append to
dataString the HTML string to parse and append
Triggersmodel.jstree changed.jstree
_append_json_data (obj, data)

appends JSON content to the tree. Used internally.

objmixed the node to append to
dataString the JSON object to parse and append
force_processingBoolean internal param - do not set
Triggersmodel.jstree changed.jstree
_parse_model_from_html (d [, p, ps])

parses a node from a jQuery object and appends them to the in memory tree model. Used internally.

djQuery the jQuery object to parse
pString the parent ID
psArray list of all parents
ReturnsString the ID of the object added to the model
_parse_model_from_flat_json (d [, p, ps])

parses a node from a JSON object (used when dealing with flat data, which has no nesting of children, but has id and parent properties) and appends it to the in memory tree model. Used internally.

dObject the JSON object to parse
pString the parent ID
psArray list of all parents
ReturnsString the ID of the object added to the model
_parse_model_from_json (d [, p, ps])

parses a node from a JSON object and appends it to the in memory tree model. Used internally.

dObject the JSON object to parse
pString the parent ID
psArray list of all parents
ReturnsString the ID of the object added to the model
_redraw ()

redraws all nodes that need to be redrawn. Used internally.

Triggersredraw.jstree
draw_children (node)

redraws a single node's children. Used internally.

nodemixed the node whose children will be redrawn
redraw_node (node, deep, is_callback, force_render)

redraws a single node. Used internally.

nodemixed the node to redraw
deepBoolean should child nodes be redrawn too
is_callbackBoolean is this a recursion call
force_renderBoolean should children of closed parents be drawn anyway
_open_to (obj)

opens every parent of a node (node should be loaded)

objmixed the node to reveal
activate_node (obj, e)

called when a node is selected by the user. Used internally.

objmixed the node
eObject the related event
Triggersactivate_node.jstree changed.jstree
hover_node (obj)

applies the hover state on a node, called when a node is hovered by the user. Used internally.

objmixed
Triggershover_node.jstree
dehover_node (obj)

removes the hover state from a nodecalled when a node is no longer hovered by the user. Used internally.

objmixed
Triggersdehover_node.jstree
get_state ()

gets the current state of the tree so that it can be restored later with set_state(state). Used internally.

ReturnsObject
set_state (state [, callback])

sets the state of the tree. Used internally.

stateObject the state to restore. Keep in mind this object is passed by reference and jstree will modify it.
callbackFunction an optional function to execute once the state is restored.
Triggersset_state.jstree
set_text (obj, val)

set the text value of a node. Used internally, please use rename_node(obj, val).

objmixed the node, you can pass an array to set the text on multiple nodes
valString the new text value
ReturnsBoolean
Triggersset_text.jstree
check (chk, obj, par, pos)

check if an operation is premitted on the tree. Used internally.

chkString the operation to check, can be "create_node", "rename_node", "delete_node", "copy_node" or "move_node"
objmixed the node
parmixed the parent
posmixed the position to insert at, or if "rename_node" - the new name
moremixed some various additional information, for example if a "move_node" operations is triggered by DND this will be the hovered node
ReturnsBoolean

Checkbox plugin


This plugin renders checkbox icons in front of each node, making multiple selection much easier.

It also supports tri-state behavior, meaning that if a node has a few of its children checked it will be rendered as undetermined, and state will be propagated up.

_undetermined ()

set the undetermined state where and if necessary. Used internally.

_cascade_new_checked_state (id, checkedState)

Cascades checked state to a node and all its descendants. This function does NOT affect hidden and disabled nodes (or their descendants).

However if these unaffected nodes are already selected their ids will be included in the returned array.

idstring the node ID
checkedStatebool should the nodes be checked or not

Contextmenu plugin


Shows a context menu when a node is right-clicked.

_show_contextmenu (obj, x, y, i)

show the prepared context menu for a node

objmixed the node
xNumber the x-coordinate relative to the document to show the menu at
yNumber the y-coordinate relative to the document to show the menu at
iNumber the object of items to show
Triggersshow_contextmenu.jstree

Sort plugin


Automatically sorts all siblings in the tree according to a sorting function.

sort (obj [, deep])

used to sort a node's children

objmixed the node
deepBoolean if set to true nodes are sorted recursively.
Triggerssearch.jstree