diff --git a/README.txt b/README.txt index 17b93255..5070d25e 100644 --- a/README.txt +++ b/README.txt @@ -5,4 +5,12 @@ Copyright (c) 2011 Ivan Bozhanov (vakata.com) Dual licensed under the MIT and GPL licenses: http://www.opensource.org/licenses/mit-license.php - http://www.gnu.org/licenses/gpl.html \ No newline at end of file + http://www.gnu.org/licenses/gpl.html + +A list of useful pages: + http://www.jstree.com/demo + http://www.jstree.com/documentation + https://groups.google.com/forum/#!forum/jstree + +You can support the project on PayPal: + http://bit.ly/jNIuWd \ No newline at end of file diff --git a/_docs/files/_license-txt.html b/_docs/files/_license-txt.html index eff53412..d77caeb3 100644 --- a/_docs/files/_license-txt.html +++ b/_docs/files/_license-txt.html @@ -11,15 +11,15 @@ -
jstree is licensed same as jQuery.
The MIT License is recommended for most projects. It is simple and easy to understand and it places almost no restrictions on what you can do with jstree.
If the GPL suits your project better you are also free to use jstree under that license.
You don’t have to do anything special to choose one license or the other and you don’t have to notify anyone which license you are using. You are free to use jstree in commercial projects as long as the copyright header is left intact.
Licenses
jstree is licensed same as jQuery.
The MIT License is recommended for most projects. It is simple and easy to understand and it places almost no restrictions on what you can do with jstree.
If the GPL suits your project better you are also free to use jstree under that license.
You don’t have to do anything special to choose one license or the other and you don’t have to notify anyone which license you are using. You are free to use jstree in commercial projects as long as the copyright header is left intact.
Licenses
# Copyright © 2010 Ivan Bozhanov (http://vakata.com)
Introduction
Features at a glance
Including the files
First of all, as jsTree is a jQuery component, you need to include jQuery itself. jsTree v.1.0 requires jQuery version 1.4.4 :
<script type="text/javascript" src="_lib/jquery.js"></script>
Then you need to include jstree itself :
<script type="text/javascript" src="jquery.jstree.js"></script>
You may change the path to whatever you like, but it is recommended not to rename jquery.tree.js (or jquery.tree.min.js) as the filename may be used for path autodetection (for example in the jstree.themes.js plugin, however all official plugins will provide an alternative way of specifying any needed path manually).
Additionally some plugins have dependencies. If a plugin detects that a dependency is missing, it will throw an error.
Creating and configuring an instance
You can create a tree in the following manner ($().jstree) :
jQuery("some-selector-to-container-node-here").jstree([ config_object ]);
In the optional config object you specify all the options that you want to set. Each plugin will describe its configuration and defaults. Each plugin’s options (even the core) are set in their own subobject, which is named after the plugin. For example all of the core’s options are set in the core key of the config object.
jQuery("some-selector-to-container-node-here") ++ .jstree({ /* configuration here */ });Usage
Introduction
- jsTree is a javascript based, cross browser tree component. It is packaged as a jQuery plugin.
- jsTree is absolutely free
- jsTree is a one man project and relies on its great community for feature requests & bug reports. Join in!
- jsTree passes jslint validation, minifies nicely and does not modify the global scope in any way.
- jsTree uses plugins so feel free to remove any plugins you do not use (or use the download builder) or create your own plugins.
Features at a glance
- Various data sources - HTML, JSON, XML
- Supports AJAX loading
- Drag & drop support
- Highly configurable
- Theme support + included themes
- Uses jQuery’s event system
- Optional keyboard navigation
- Inline editing
- Open/close optional animation
- Define node types and fine tune them
- Configurable multitree drag & drop
- Optional checkbox tree support
- Search function
- Supports plugins
- Optional state saving using cookies
- RTL support
- Optional sorting / unique management
Including the files
First of all, as jsTree is a jQuery component, you need to include jQuery itself. jsTree v.1.0 requires jQuery version 1.4.4
<script type="text/javascript" src="_lib/jquery.js"></script>Then you need to include jstree itself
<script type="text/javascript" src="jquery.jstree.js"></script>You may change the path to whatever you like, but it is recommended not to rename jquery.tree.js (or jquery.tree.min.js) as the filename may be used for path autodetection (for example in the jstree.themes.js plugin, however all official plugins will provide an alternative way of specifying any needed path manually).
Additionally some plugins have dependencies. If a plugin detects that a dependency is missing, it will throw an error.
Creating and configuring an instance
You can create a tree in the following manner ($().jstree) :
jQuery("some-selector-to-container-node-here").jstree([ config_object ]);In the optional config object you specify all the options that you want to set. Each plugin will describe its configuration and defaults. Each plugin’s options (even the core) are set in their own subobject, which is named after the plugin. For example all of the core’s options are set in the core key of the config object.
jQuery("some-selector-to-container-node-here") .jstree({ core : { /* core options go here */ @@ -26,19 +26,19 @@ /* METHOD TWO */ jQuery.jstree._reference(needle) - .operation_name([ argument_1, argument_2, ...]);jsTree uses events to notify of any changes happening in the tree. All events fire on the tree container in the jstree namespace and are named after the function that triggered them. Personally I believe it is best to bind to the events and then create the instance.
jQuery("some-container") + .operation_name([ argument_1, argument_2, ...]);Events
jsTree uses events to notify of any changes happening in the tree. All events fire on the tree container in the jstree namespace and are named after the function that triggered them. Personally I believe it is best to bind to the events and then create the instance.
jQuery("some-container") .bind("loaded.jstree", function (event, data) { alert("TREE IS LOADED"); }) - .jstree({ /* configuration here */ });Please note the second parameter data. Read the documentation on each event to see what it contains.
Please note the second parameter data. Read the documentation on each event to see what it contains.
TODO;
The only required part of jstree it consists of a few functions bound to the $.jstree object, the actual plugin function and a few core functions for manipulating a tree.
jstree. | The only required part of jstree it consists of a few functions bound to the $.jstree object, the actual plugin function and a few core functions for manipulating a tree. |
$.jstree. | Some static functions and variables, unless you know exactly what you are doing do not use these, but $().jstree instead. |
$.jstree | object Contains all static functions and variables used by jstree, some plugins also append variables. |
$.jstree. | boolean indicating if the client is running Internet Explorer 6 |
$.jstree. | boolean indicating if the client is running Internet Explorer 7 |
$.jstree. | boolean indicating if the client is running Firefox 2 |
$.jstree. | Creates a new jstree instance, any arguments after the first one are merged and used to configure the tree. |
$.jstree. | |
$.jstree. | Destroys an instance, and also clears `jstree-` prefixed classes and all events in the `jstree` namespace |
$.jstree. | Call a function on the instance and return the result |
$.jstree. | Returns an instance |
$.jstree. | Returns the currently focused instance (by default once an instance is created it is focused) |
$.jstree. | Make an instance focused (which defocuses the previously focused instance) |
$.jstree. | Register a plugin |
$.jstree. | object storing all the default configuration options for every plugin and the core. |
$().jstree() | The actual plugin wrapper, use this to create instances or execute functions on created instances. |
$().jstree | Creates an instance using the specified objects for containers, or executes a command on an instance, specified by a container. |
$.jstree. | |
$.jstree. | integer indicating the width of the client scrollbar |
jstree | |
data | object Provides storage for plugins (aside from private variables). |
get_index | Returns an integer, which is the instance’s index. |
get_container | Returns the jQuery extended container of the tree (the element you used when constructing the tree). |
get_container_ul | Returns the jQuery extended first UL node inside the container of the tree. |
get_settings | Returns the settings for the tree. |
__trigger | Used internally to trigger events on the container node. |
CORE options | |
config. | mixed used to store all localization strings. |
CORE functions | |
_get_string | Used to get the common string in the tree. |
init | Used internally. |
__loaded | This event is triggered in the jstree namespace when data is first rendered in the tree. |
lock | Used to lock the tree. |
lock | This event is triggered in the jstree namespace when the tree is locked. |
unlock | Used to unlock the tree. |
unlock | This event is triggered in the jstree namespace when the tree is unlocked. |
is_locked | Used to get the locked status of the tree. |
get_node | Get a hold of the LI node (which represents the jstree node). |
get_next | Get the next sibling of a node |
get_prev | Get the previous sibling of a node |
get_parent | Get the parent of a node |
get_children | Get all the children of a node |
is_parent | Check if a node is a parent. |
is_loaded | Check if a node is loaded. |
is_loading | Check if a node is currently loading. |
is_open | Check if a node is currently open. |
is_closed | Check if a node is currently closed. |
is_leaf | Check if a node is a leaf node (has no children). |
load_node | Load the children of a node. |
load_node | This event is triggered in the jstree namespace when a node is loaded (succesfully or not). |
_load_node | Load the children of a node, but as opposed to load_node does not change any visual properties or trigger events. |
open_node | Open a node so that its children are visible. |
open_node | This event is triggered in the jstree namespace when a node is successfully opened (but if animation is used this event is triggered BEFORE the animation completes). |
__after_open | This event is triggered in the jstree namespace when a node is successfully opened AFTER the animation completes). |
close_node | Close a node so that its children are not visible. |
close_node | This event is triggered in the jstree namespace when a node is closed (but if animation is used this event is triggered BEFORE the animation completes). |
__after_close | This event is triggered in the jstree namespace when a node is closed AFTER the animation completes). |
toggle_node | |
open_all | Open all nodes from a certain node down. |
open_all | This event is triggered in the jstree namespace when an open_all call completes. |
close_all | Close all nodes from a certain node down. |
close_all | This event is triggered in the jstree namespace when a close_all call completes. |
clean_node | This function converts inserted nodes to the required by jsTree format. |
correct_node | This function corrects the open/closed/leaf state as data changes (as the user interacts with the tree). |
The only required part of jstree it consists of a few functions bound to the $.jstree object, the actual plugin function and a few core functions for manipulating a tree.
jstree. | The only required part of jstree it consists of a few functions bound to the $.jstree object, the actual plugin function and a few core functions for manipulating a tree. |
$.jstree. | Some static functions and variables, unless you know exactly what you are doing do not use these, but $().jstree instead. |
$.jstree | object Contains all static functions and variables used by jstree, some plugins also append variables. |
$.jstree. | string the version of jstree |
$.jstree. | boolean indicating if the client is running Internet Explorer 6 |
$.jstree. | boolean indicating if the client is running Internet Explorer 7 |
$.jstree. | boolean indicating if the client is running Firefox 2 |
$.jstree. | Creates a new jstree instance, any arguments after the first one are merged and used to configure the tree. |
$.jstree. | |
$.jstree. | Destroys an instance, and also clears `jstree-` prefixed classes and all events in the `jstree` namespace |
$.jstree. | Call a function on the instance and return the result |
$.jstree. | Returns an instance |
$.jstree. | Returns the currently focused instance (by default once an instance is created it is focused) |
$.jstree. | Make an instance focused (which defocuses the previously focused instance) |
$.jstree. | Register a plugin |
$.jstree. | object storing all the default configuration options for every plugin and the core. |
$().jstree() | The actual plugin wrapper, use this to create instances or execute functions on created instances. |
$().jstree | Creates an instance using the specified objects for containers, or executes a command on an instance, specified by a container. |
$.jstree. | |
$.jstree. | integer indicating the width of the client scrollbar |
jstree | |
data | object Provides storage for plugins (aside from private variables). |
get_index | Returns an integer, which is the instance’s index. |
get_container | Returns the jQuery extended container of the tree (the element you used when constructing the tree). |
get_container_ul | Returns the jQuery extended first UL node inside the container of the tree. |
get_settings | Returns the settings for the tree. |
__trigger | Used internally to trigger events on the container node. |
CORE options | |
config. | mixed used to store all localization strings. |
CORE functions | |
_get_string | Used to get the common string in the tree. |
init | Used internally. |
__loaded | This event is triggered in the jstree namespace when data is first rendered in the tree. |
lock | Used to lock the tree. |
lock | This event is triggered in the jstree namespace when the tree is locked. |
unlock | Used to unlock the tree. |
unlock | This event is triggered in the jstree namespace when the tree is unlocked. |
is_locked | Used to get the locked status of the tree. |
get_node | Get a hold of the LI node (which represents the jstree node). |
get_next | Get the next sibling of a node |
get_prev | Get the previous sibling of a node |
get_parent | Get the parent of a node |
get_children | Get all the children of a node |
is_parent | Check if a node is a parent. |
is_loaded | Check if a node is loaded. |
is_loading | Check if a node is currently loading. |
is_open | Check if a node is currently open. |
is_closed | Check if a node is currently closed. |
is_leaf | Check if a node is a leaf node (has no children). |
load_node | Load the children of a node. |
load_node | This event is triggered in the jstree namespace when a node is loaded (succesfully or not). |
_load_node | Load the children of a node, but as opposed to load_node does not change any visual properties or trigger events. |
open_node | Open a node so that its children are visible. |
open_node | This event is triggered in the jstree namespace when a node is successfully opened (but if animation is used this event is triggered BEFORE the animation completes). |
__after_open | This event is triggered in the jstree namespace when a node is successfully opened AFTER the animation completes). |
close_node | Close a node so that its children are not visible. |
close_node | This event is triggered in the jstree namespace when a node is closed (but if animation is used this event is triggered BEFORE the animation completes). |
__after_close | This event is triggered in the jstree namespace when a node is closed AFTER the animation completes). |
toggle_node | |
open_all | Open all nodes from a certain node down. |
open_all | This event is triggered in the jstree namespace when an open_all call completes. |
close_all | Close all nodes from a certain node down. |
close_all | This event is triggered in the jstree namespace when a close_all call completes. |
clean_node | This function converts inserted nodes to the required by jsTree format. |
correct_node | This function corrects the open/closed/leaf state as data changes (as the user interacts with the tree). |
scroll_to_node | This function scrolls the container to the desired node (if needed). |
get_state | This function returns the current state of the tree (as collected from all active plugins). |
set_state | This function returns sets the state of the tree. |
set_state | This event is triggered in the jstree namespace when a set_state call completes. |
refresh | This function saves the current state, reloads the complete tree and returns it to the saved state. |
refresh | This event is triggered in the jstree namespace when a refresh call completes. |
get_text | This function returns the title of the node. |
set_text | This function sets the title of the node. |
set_text | This event is triggered in the jstree namespace when a set_text call completes. |
parse_json | This function returns a jQuery node after parsing a JSON object (a LI node for single elements or an UL node for multiple). |
Some static functions and variables, unless you know exactly what you are doing do not use these, but $().jstree instead.
Some static functions and variables, unless you know exactly what you are doing do not use these, but $().jstree instead.
Destroys an instance, and also clears `jstree-` prefixed classes and all events in the `jstree` namespace
instance | mixed the instance to destroy (this argument is passed to $.jstree._reference to get the instance) |
Destroys an instance, and also clears `jstree-` prefixed classes and all events in the `jstree` namespace
instance | mixed the instance to destroy (this argument is passed to $.jstree._reference to get the instance) |
Call a function on the instance and return the result
instance | mixed the instance to destroy (this argument is passed to $.jstree._reference to get the instance) |
operation | string the operation to execute |
args | array the arguments to pass to the function |
Call a function on the instance and return the result
instance | mixed the instance to destroy (this argument is passed to $.jstree._reference to get the instance) |
operation | string the operation to execute |
args | array the arguments to pass to the function |
Make an instance focused (which defocuses the previously focused instance)
instance | mixed the instance to focus (this argument is passed to $.jstree._reference to get the instance) |
Make an instance focused (which defocuses the previously focused instance)
instance | mixed the instance to focus (this argument is passed to $.jstree._reference to get the instance) |
Register a plugin
plugin_name | string the name of the new plugin (it will be used as a key in an object - make sure it is valid) |
plugin_data | object consists of 4 keys. Default is: |
{ __construct : $.noop, // this function will be executed when a new instance is created @@ -54,19 +56,19 @@-$().jstree
$.fn.jstree = function ( settings ) Creates an instance using the specified objects for containers, or executes a command on an instance, specified by a container.
Parameters
settings mixed
- if you pass an object a new instance will be created (using $.jstree.__construct) for each of the objects in the jquery collection, if an instance already exists on the container it will be destroyed first
- if you pass a string it will be executed using $.jstree.__call on each instance
Examples
// this creates an instance ++$("#some-id").jstree("select_node", "#the-id-to-select");$().jstree
$.fn.jstree = function ( settings ) Creates an instance using the specified objects for containers, or executes a command on an instance, specified by a container.
Parameters
settings mixed
- if you pass an object a new instance will be created (using $.jstree.__construct) for each of the objects in the jquery collection, if an instance already exists on the container it will be destroyed first
- if you pass a string it will be executed using $.jstree.__call on each instance
Examples
// this creates an instance $("#some-id").jstree({ plugins : [ "html_data", "themes", "ui" ] }); // this executes a function on the instance -$("#some-id").jstree("select_node", "#the-id-to-select");See also
See also
-+jstree
Summary
data object Provides storage for plugins (aside from private variables). get_index Returns an integer, which is the instance’s index. get_container Returns the jQuery extended container of the tree (the element you used when constructing the tree). get_container_ul Returns the jQuery extended first UL node inside the container of the tree. get_settings Returns the settings for the tree. __trigger Used internally to trigger events on the container node. CORE options config. core. strings mixed used to store all localization strings. CORE functions _get_string Used to get the common string in the tree. init Used internally. __loaded This event is triggered in the jstree namespace when data is first rendered in the tree. lock Used to lock the tree. lock This event is triggered in the jstree namespace when the tree is locked. unlock Used to unlock the tree. unlock This event is triggered in the jstree namespace when the tree is unlocked. is_locked Used to get the locked status of the tree. get_node Get a hold of the LI node (which represents the jstree node). get_next Get the next sibling of a node get_prev Get the previous sibling of a node get_parent Get the parent of a node get_children Get all the children of a node is_parent Check if a node is a parent. is_loaded Check if a node is loaded. is_loading Check if a node is currently loading. is_open Check if a node is currently open. is_closed Check if a node is currently closed. is_leaf Check if a node is a leaf node (has no children). load_node Load the children of a node. load_node This event is triggered in the jstree namespace when a node is loaded (succesfully or not). _load_node Load the children of a node, but as opposed to load_node does not change any visual properties or trigger events. open_node Open a node so that its children are visible. open_node This event is triggered in the jstree namespace when a node is successfully opened (but if animation is used this event is triggered BEFORE the animation completes). __after_open This event is triggered in the jstree namespace when a node is successfully opened AFTER the animation completes). close_node Close a node so that its children are not visible. close_node This event is triggered in the jstree namespace when a node is closed (but if animation is used this event is triggered BEFORE the animation completes). __after_close This event is triggered in the jstree namespace when a node is closed AFTER the animation completes). toggle_node open_all Open all nodes from a certain node down. open_all This event is triggered in the jstree namespace when an open_all call completes. close_all Close all nodes from a certain node down. close_all This event is triggered in the jstree namespace when a close_all call completes. clean_node This function converts inserted nodes to the required by jsTree format. correct_node This function corrects the open/closed/leaf state as data changes (as the user interacts with the tree). @@ -97,21 +99,21 @@ "Loading ..." : "Please wait ..." } } -});jstree
Summary
data object Provides storage for plugins (aside from private variables). get_index Returns an integer, which is the instance’s index. get_container Returns the jQuery extended container of the tree (the element you used when constructing the tree). get_container_ul Returns the jQuery extended first UL node inside the container of the tree. get_settings Returns the settings for the tree. __trigger Used internally to trigger events on the container node. CORE options config. core. strings mixed used to store all localization strings. CORE functions _get_string Used to get the common string in the tree. init Used internally. __loaded This event is triggered in the jstree namespace when data is first rendered in the tree. lock Used to lock the tree. lock This event is triggered in the jstree namespace when the tree is locked. unlock Used to unlock the tree. unlock This event is triggered in the jstree namespace when the tree is unlocked. is_locked Used to get the locked status of the tree. get_node Get a hold of the LI node (which represents the jstree node). get_next Get the next sibling of a node get_prev Get the previous sibling of a node get_parent Get the parent of a node get_children Get all the children of a node is_parent Check if a node is a parent. is_loaded Check if a node is loaded. is_loading Check if a node is currently loading. is_open Check if a node is currently open. is_closed Check if a node is currently closed. is_leaf Check if a node is a leaf node (has no children). load_node Load the children of a node. load_node This event is triggered in the jstree namespace when a node is loaded (succesfully or not). _load_node Load the children of a node, but as opposed to load_node does not change any visual properties or trigger events. open_node Open a node so that its children are visible. open_node This event is triggered in the jstree namespace when a node is successfully opened (but if animation is used this event is triggered BEFORE the animation completes). __after_open This event is triggered in the jstree namespace when a node is successfully opened AFTER the animation completes). close_node Close a node so that its children are not visible. close_node This event is triggered in the jstree namespace when a node is closed (but if animation is used this event is triggered BEFORE the animation completes). __after_close This event is triggered in the jstree namespace when a node is closed AFTER the animation completes). toggle_node open_all Open all nodes from a certain node down. open_all This event is triggered in the jstree namespace when an open_all call completes. close_all Close all nodes from a certain node down. close_all This event is triggered in the jstree namespace when a close_all call completes. clean_node This function converts inserted nodes to the required by jsTree format. correct_node This function corrects the open/closed/leaf state as data changes (as the user interacts with the tree). scroll_to_node This function scrolls the container to the desired node (if needed). get_state This function returns the current state of the tree (as collected from all active plugins). set_state This function returns sets the state of the tree. set_state This event is triggered in the jstree namespace when a set_state call completes. refresh This function saves the current state, reloads the complete tree and returns it to the saved state. refresh This event is triggered in the jstree namespace when a refresh call completes. get_text This function returns the title of the node. set_text This function sets the title of the node. set_text This event is triggered in the jstree namespace when a set_text call completes. parse_json This function returns a jQuery node after parsing a JSON object (a LI node for single elements or an UL node for multiple).
_get_string : function ( s )
Used to get the common string in the tree.
If config.core.strings is set to a function, that function is called with a single parameter (the needed string), the response is returned.
If config.core.strings is set to an object, the key named as the needed string is returned.
If config.core.strings is not set, the the needed string is returned.
needed_string | string the needed string |
_get_string : function ( s )
Used to get the common string in the tree.
If config.core.strings is set to a function, that function is called with a single parameter (the needed string), the response is returned.
If config.core.strings is set to an object, the key named as the needed string is returned.
If config.core.strings is not set, the the needed string is returned.
needed_string | string the needed string |
This event is triggered in the jstree namespace when the tree is locked.
data.inst | the instance |
data.args | array the arguments passed to the function |
data.plugin | string the function’s plugin (here it will be ”core” but if the function is extended it may be something else). |
data.rslt | null |
$("div").bind("lock.jstree", function (e, data) { data.inst.do_something(); });
This event is triggered in the jstree namespace when the tree is unlocked.
data.inst | the instance |
data.args | array the arguments passed to the function |
data.plugin | string the function’s plugin (here it will be ”core” but if the function is extended it may be something else). |
data.rslt | null |
$("div").bind("unlock.jstree", function (e, data) { data.inst.do_something(); });
Load the children of a node.
obj | mixed this is used as a jquery selector - can be jQuery object, DOM node, string, etc. Use -1 to load the root nodes. |
callback | a function to be executed in the tree’s scope. Receives two arguments: obj (the same node used to call load_node), status (a boolean indicating if the node was loaded successfully. |
true | obj is a valid node and will try loading it |
false | obj is not a valid node |
Load the children of a node.
obj | mixed this is used as a jquery selector - can be jQuery object, DOM node, string, etc. Use -1 to load the root nodes. |
callback | a function to be executed in the tree’s scope. Receives two arguments: obj (the same node used to call load_node), status (a boolean indicating if the node was loaded successfully. |
true | obj is a valid node and will try loading it |
false | obj is not a valid node |
This event is triggered in the jstree namespace when a node is loaded (succesfully or not).
data.inst | the instance |
data.args | array the arguments passed to the function |
data.plugin | string the function’s plugin (here it will be ”core” but if the function is extended it may be something else). |
data.rslt | object which contains two keys obj (the loaded node) and status - whether the node was loaded successfully. |
$("div").bind("load_node.jstree", function (e, data) { if(data.rslt.status) { data.inst.open_node(data.rslt.obj); } });
_load_node : function ( obj, callback )
Load the children of a node, but as opposed to load_node does not change any visual properties or trigger events. This function is used in load_node internally. The idea is for data source plugins to overwrite this function. This implementation (from the core) only uses markup found in the tree container, and does not load async.
obj | mixed this is used as a jquery selector - can be jQuery object, DOM node, string, etc. Use -1 to load the root nodes. |
callback | a function to be executed in the tree’s scope. Receives one argument: status (a boolean indicating if the node was loaded successfully). |
_load_node : function ( obj, callback )
Load the children of a node, but as opposed to load_node does not change any visual properties or trigger events. This function is used in load_node internally. The idea is for data source plugins to overwrite this function. This implementation (from the core) only uses markup found in the tree container, and does not load async.
obj | mixed this is used as a jquery selector - can be jQuery object, DOM node, string, etc. Use -1 to load the root nodes. |
callback | a function to be executed in the tree’s scope. Receives one argument: status (a boolean indicating if the node was loaded successfully). |
Open a node so that its children are visible. If the node is not loaded try loading it first.
obj | mixed this is used as a jquery selector - can be jQuery object, DOM node, string, etc. |
callback | a function to be executed in the tree’s scope. Receives two arguments: obj (the node being opened) and status (a boolean indicating if the node was opened successfully). |
animation | the duration in miliseconds of the slideDown animation. If not supplied the jQuery default is used. Please note that on IE6 a 0 is enforced here due to performance issues. |
Open a node so that its children are visible. If the node is not loaded try loading it first.
obj | mixed this is used as a jquery selector - can be jQuery object, DOM node, string, etc. |
callback | a function to be executed in the tree’s scope. Receives two arguments: obj (the node being opened) and status (a boolean indicating if the node was opened successfully). |
animation | the duration in miliseconds of the slideDown animation. If not supplied the jQuery default is used. Please note that on IE6 a 0 is enforced here due to performance issues. |
This event is triggered in the jstree namespace when a node is successfully opened (but if animation is used this event is triggered BEFORE the animation completes). See __after_open.
data.inst | the instance |
data.args | array the arguments passed to the function |
data.plugin | string the function’s plugin (here it will be ”core” but if the function is extended it may be something else). |
data.rslt | object which contains a single key: obj (the opened node). |
$("div").bind("open_node.jstree", function (e, data) { +-open_node
This event is triggered in the jstree namespace when a node is successfully opened (but if animation is used this event is triggered BEFORE the animation completes). See __after_open.
Parameters
data.inst the instance data.args array the arguments passed to the function data.plugin string the function’s plugin (here it will be ”core” but if the function is extended it may be something else). data.rslt object which contains a single key: obj (the opened node). Example
$("div").bind("open_node.jstree", function (e, data) { data.rslt.obj.find('> ul > .jstree-closed').each(function () { data.inst.open_node(this); } });__after_open
This event is triggered in the jstree namespace when a node is successfully opened AFTER the animation completes). See open_node.
Parameters
data.inst the instance data.rslt object which contains a single key: obj (the opened node). Example
$("div").bind("__after_open.jstree", function (e, data) { +-__after_open
This event is triggered in the jstree namespace when a node is successfully opened AFTER the animation completes). See open_node.
Parameters
data.inst the instance data.rslt object which contains a single key: obj (the opened node). Example
$("div").bind("__after_open.jstree", function (e, data) { data.rslt.obj.find('> ul > .jstree-closed').each(function () { data.inst.open_node(this); } });+close_node
Close a node so that its children are not visible.
Parameters
obj mixed this is used as a jquery selector - can be jQuery object, DOM node, string, etc. animation the duration in miliseconds of the slideDown animation. If not supplied the jQuery default is used. Please note that on IE6 a 0 is enforced here due to performance issues. Triggers
-close_node
Close a node so that its children are not visible.
Parameters
obj mixed this is used as a jquery selector - can be jQuery object, DOM node, string, etc. animation the duration in miliseconds of the slideDown animation. If not supplied the jQuery default is used. Please note that on IE6 a 0 is enforced here due to performance issues. Triggers
close_node
This event is triggered in the jstree namespace when a node is closed (but if animation is used this event is triggered BEFORE the animation completes). See __after_close.
Parameters
data.inst the instance data.args array the arguments passed to the function data.plugin string the function’s plugin (here it will be ”core” but if the function is extended it may be something else). data.rslt object which contains a single key: obj (the closed node). Example
$("div").bind("close_node.jstree", function (e, data) { +-close_node
This event is triggered in the jstree namespace when a node is closed (but if animation is used this event is triggered BEFORE the animation completes). See __after_close.
Parameters
data.inst the instance data.args array the arguments passed to the function data.plugin string the function’s plugin (here it will be ”core” but if the function is extended it may be something else). data.rslt object which contains a single key: obj (the closed node). Example
$("div").bind("close_node.jstree", function (e, data) { data.rslt.obj.children('ul').remove(); });__after_close
This event is triggered in the jstree namespace when a node is closed AFTER the animation completes). See close_node.
Parameters
data.inst the instance data.rslt object which contains a single key: obj (the opened node). Example
$("div").bind("__after_close.jstree", function (e, data) { +__after_close
This event is triggered in the jstree namespace when a node is closed AFTER the animation completes). See close_node.
Parameters
data.inst the instance data.rslt object which contains a single key: obj (the opened node). Example
$("div").bind("__after_close.jstree", function (e, data) { data.rslt.obj.children('ul').remove(); });-+open_all
Open all nodes from a certain node down.
Parameters
obj mixed this is used as a jquery selector - can be jQuery object, DOM node, string, etc. If -1 is used or is omitted all nodes in the tree are opened. animation the duration of the slideDown animation when opening the nodes. If not set 0 is enforced for performance issues. original_obj used internally to keep track of the recursion - do not set manually! Triggers
open_all
Open all nodes from a certain node down.
Parameters
obj mixed this is used as a jquery selector - can be jQuery object, DOM node, string, etc. If -1 is used or is omitted all nodes in the tree are opened. animation the duration of the slideDown animation when opening the nodes. If not set 0 is enforced for performance issues. original_obj used internally to keep track of the recursion - do not set manually! Triggers
-open_all
This event is triggered in the jstree namespace when an open_all call completes.
Parameters
data.inst the instance data.args array the arguments passed to the function data.plugin string the function’s plugin (here it will be ”core” but if the function is extended it may be something else). data.rslt object which contains a single key: obj (the node used in the call). Example
$("div").bind("open_all.jstree", function (e, data) { alert('DONE'); });+close_all
Close all nodes from a certain node down.
Parameters
obj mixed this is used as a jquery selector - can be jQuery object, DOM node, string, etc. If -1 is used or is omitted all nodes in the tree are closed. animation the duration of the slideDown animation when closing the nodes. If not set 0 is enforced for performance issues. Triggers
close_all
Close all nodes from a certain node down.
Parameters
obj mixed this is used as a jquery selector - can be jQuery object, DOM node, string, etc. If -1 is used or is omitted all nodes in the tree are closed. animation the duration of the slideDown animation when closing the nodes. If not set 0 is enforced for performance issues. Triggers
-close_all
This event is triggered in the jstree namespace when a close_all call completes.
Parameters
data.inst the instance data.args array the arguments passed to the function data.plugin string the function’s plugin (here it will be ”core” but if the function is extended it may be something else). data.rslt object which contains a single key: obj (the node used in the call). Example
$("div").bind("close_all.jstree", function (e, data) { alert('DONE'); });- + -- + -clean_node
- + -
clean_node : function ( obj ) This function converts inserted nodes to the required by jsTree format. It takes care of converting a simple unodreder list to the internally used markup. The core calls this function automatically when new data arrives (by binding to the load_node event). Each plugin may override this function to include its own markup, but keep in mind to do it like that:
clean_node : function(obj) { +- + -- + -clean_node
- + -
clean_node : function ( obj ) This function converts inserted nodes to the required by jsTree format. It takes care of converting a simple unodreder list to the internally used markup. The core calls this function automatically when new data arrives (by binding to the load_node event). Each plugin may override this function to include its own markup, but keep in mind to do it like that:
clean_node : function(obj) { obj = this.__call_old(); obj.each(function () { // do your stuff here @@ -192,20 +194,72 @@+correct_node
This function corrects the open/closed/leaf state as data changes (as the user interacts with the tree). The core calls this function automatically when a node is opened, deleted or moved.
Parameters
obj mixed this is used as a jquery selector - can be jQuery object, DOM node, string, etc. If -1 is used or is omitted the root nodes are processed. Returns
jQuery collection the processed children of the original node. + ++ +get_state
get_state : function () This function returns the current state of the tree (as collected from all active plugins). Plugin authors: pay special attention to the way this function is extended for new plugins. In your plugin code write:
get_state : function () { + var state = this.__call_old(); + state.your-plugin-name = <some-value-you-collect>; + return state; +}Returns
object the current state of the instance + +set_state
This function returns sets the state of the tree. Plugin authors: pay special attention to the way this function is extended for new plugins. In your plugin code write:
set_state : function (state, callback) { + if(this.__call_old()) { + if(state.your-plugin-name) { + + // restore using `state.your-plugin-name` + // if you need some async activity so that you return to this bit of code + // do not delete state.your-plugin-name and return false (see core's function for example) + + delete state.your-plugin-name; + this.set_state(state, callback); + return false; + } + return true; + } + return false; +}Parameters
state object the state to restore to callback function this will be executed in the instance’s scope once restoring is done Returns
boolean the return value is used to determine the phase of restoration Triggers
+ ++ ++ ++ +get_text
get_text : function ( obj, remove_html ) This function returns the title of the node.
Parameters
obj mixed this is used as a jquery selector - can be jQuery object, DOM node, string, etc. remove_html boolean set to true to return plain text instead of HTML Returns
string the title of the node, specified by obj + +set_text
This function sets the title of the node. This is a low-level function, you’d be better off using <rename>.
Parameters
obj mixed this is used as a jquery selector - can be jQuery object, DOM node, string, etc. val string the new title of the node (can be HTMl too) Returns
boolean was the rename successfull Triggers
+ +set_text
This event is triggered in the jstree namespace when a set_text call completes.
Parameters
data.inst the instance data.args array the arguments passed to the function data.plugin string the function’s plugin (here it will be ”core” but if the function is extended it may be something else) data.rslt object which contains a two key: obj (the node) and val (the new title). Example
$("div").bind("set_text.jstree", function (e, data) { + alert("Renamed to: " + data.rslt.val); +});+parse_json
parse_json : function ( node ) This function returns a jQuery node after parsing a JSON object (a LI node for single elements or an UL node for multiple). This function will use the default title from jstree.config.core.strings if none is specified.
Parameters
node mixed the input to parse // can be a string +"The title of the parsed node" +// array of strings +[ "Node 1", "Node 2" ] +// an object +{ "title" : "The title of the parsed node" } +// you can manipulate the output +{ "title" : "The title of the parsed node", "li_attr" : { "id" : "id_for_li" }, "a_attr" : { "href" : "http://jstree.com" } } +// you can supply metadata, which you can later access using $(the_li_node).data() +{ "title" : "The title of the parsed node", "data" : { <some-values-here> } } +// you can supply children (they can be objects too) +{ "title" : "The title of the parsed node", "children" : [ "Node 1", { "title" : "Node 2" } ] }Returns
jQuery the LI (or UL) node which was produced from the JSON -jstreejquery treeview pluginCorejstree.core.js The actual plugin wrapper, use this to create instances or execute functions on created instances.object Contains all static functions and variables used by jstree, some plugins also append variables.
$.jstree integer indicating the width of the client scrollbar
$.jstree.SCROLLBAR_WIDTH Used to get the common string in the tree.
_get_string : function ( s ) Used to get the locked status of the tree.
is_locked : function () Get a hold of the LI node (which represents the jstree node).
get_node : function ( obj ) Get the next sibling of a node
get_next : function ( obj, strict ) Get the previous sibling of a node
get_prev : function ( obj, strict ) Get the parent of a node
get_parent : function ( obj ) Get all the children of a node
get_children : function ( obj ) Check if a node is a parent.
is_parent : function ( obj ) Check if a node is loaded.
is_loaded : function ( obj ) Check if a node is currently loading.
is_loading : function ( obj ) Check if a node is currently open.
is_open : function ( obj ) Check if a node is currently closed.
is_closed : function ( obj ) Check if a node is a leaf node (has no children).
is_leaf : function ( obj ) Load the children of a node, but as opposed to load_node does not change any visual properties or trigger events.
_load_node : function ( obj, callback ) Load the children of a node.
toggle_node : function ( obj ) This function converts inserted nodes to the required by jsTree format.
clean_node : function ( obj ) Returns an instanceCreates a new jstree instance, any arguments after the first one are merged and used to configure the tree.Call a function on the instance and return the resultDestroys an instance, and also clears `jstree-` prefixed classes and all events in the `jstree` namespacemixed used to store all localization strings.This event is triggered in the jstree namespace when data is first rendered in the tree.Used to unlock the tree.Used to lock the tree.Open a node so that its children are visible.This event is triggered in the jstree namespace when a node is successfully opened AFTER the animation completes).Close a node so that its children are not visible.This event is triggered in the jstree namespace when a node is closed AFTER the animation completes).Open all nodes from a certain node down.+Close all nodes from a certain node down.The actual plugin wrapper, use this to create instances or execute functions on created instances.object Contains all static functions and variables used by jstree, some plugins also append variables.
$.jstree integer indicating the width of the client scrollbar
$.jstree.SCROLLBAR_WIDTH Used to get the common string in the tree.
_get_string : function ( s ) Used to get the locked status of the tree.
is_locked : function () Get a hold of the LI node (which represents the jstree node).
get_node : function ( obj ) Get the next sibling of a node
get_next : function ( obj, strict ) Get the previous sibling of a node
get_prev : function ( obj, strict ) Get the parent of a node
get_parent : function ( obj ) Get all the children of a node
get_children : function ( obj ) Check if a node is a parent.
is_parent : function ( obj ) Check if a node is loaded.
is_loaded : function ( obj ) Check if a node is currently loading.
is_loading : function ( obj ) Check if a node is currently open.
is_open : function ( obj ) Check if a node is currently closed.
is_closed : function ( obj ) Check if a node is a leaf node (has no children).
is_leaf : function ( obj ) Load the children of a node, but as opposed to load_node does not change any visual properties or trigger events.
_load_node : function ( obj, callback ) Load the children of a node.
toggle_node : function ( obj ) This function converts inserted nodes to the required by jsTree format.
clean_node : function ( obj ) This function scrolls the container to the desired node (if needed).
scroll_to_node : function ( obj ) This function returns the current state of the tree (as collected from all active plugins).
get_state : function () This function returns the title of the node.
get_text : function ( obj, remove_html ) This function returns a jQuery node after parsing a JSON object (a LI node for single elements or an UL node for multiple).
parse_json : function ( node ) Returns an instanceCreates a new jstree instance, any arguments after the first one are merged and used to configure the tree.Call a function on the instance and return the resultDestroys an instance, and also clears `jstree-` prefixed classes and all events in the `jstree` namespacemixed used to store all localization strings.This event is triggered in the jstree namespace when data is first rendered in the tree.Used to unlock the tree.Used to lock the tree.Open a node so that its children are visible.This event is triggered in the jstree namespace when a node is successfully opened AFTER the animation completes).Close a node so that its children are not visible.This event is triggered in the jstree namespace when a node is closed AFTER the animation completes).Open all nodes from a certain node down.Close all nodes from a certain node down.This function returns sets the state of the tree.This function saves the current state, reloads the complete tree and returns it to the saved state.diff --git a/_docs/files/jstree-themes-js.html b/_docs/files/jstree-themes-js.html index e7fdc9cb..4bc58d6e 100644 --- a/_docs/files/jstree-themes-js.html +++ b/_docs/files/jstree-themes-js.html @@ -40,10 +40,10 @@This function sets the title of the node.diff --git a/_docs/files/jstree-ui-js.html b/_docs/files/jstree-ui-js.html index 15101ee6..ecd4ffcc 100644 --- a/_docs/files/jstree-ui-js.html +++ b/_docs/files/jstree-ui-js.html @@ -18,10 +18,10 @@jstreejquery treeview pluginPluginsjstree.themes.js diff --git a/_docs/files/vakata-js.html b/_docs/files/vakata-js.html index 26b1fb6f..66b78b43 100644 --- a/_docs/files/vakata-js.html +++ b/_docs/files/vakata-js.html @@ -154,10 +154,10 @@jstreejquery treeview pluginPluginsjstree.ui.js diff --git a/_docs/index.html b/_docs/index.html index c4ab8dc4..7e0f3a21 100644 --- a/_docs/index.html +++ b/_docs/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/_docs/index/Classes.html b/_docs/index/Classes.html index 61e1e700..16784a9d 100644 --- a/_docs/index/Classes.html +++ b/_docs/index/Classes.html @@ -18,10 +18,10 @@jstreejquery treeview pluginCoreHelper functionsdiff --git a/_docs/index/Events.html b/_docs/index/Events.html index 18c6ca91..ad20c499 100644 --- a/_docs/index/Events.html +++ b/_docs/index/Events.html @@ -26,10 +26,10 @@jstreejquery treeview plugindiff --git a/_docs/index/Files.html b/_docs/index/Files.html index c2e03ee5..ffb697ff 100644 --- a/_docs/index/Files.html +++ b/_docs/index/Files.html @@ -11,7 +11,7 @@ -jstreejquery treeview pluginFile Index+
H Helper functions J jquery.js jstree. core.js jstree. themes.js jstree. ui.js - + -File Index
H Helper functions J jstree. core.js jstree. themes.js jstree. ui.js @@ -22,10 +22,10 @@This file includes some functions that enable CSS manipulations, contextmenus, XSLT transformations and drag’n’drop.diff --git a/_docs/index/Functions.html b/_docs/index/Functions.html index ec283939..c786a72f 100644 --- a/_docs/index/Functions.html +++ b/_docs/index/Functions.html @@ -11,7 +11,7 @@ -jstreejquery treeview pluginFunction Index+
$#! __call, $.jstree __construct, $.jstree __destruct, $.jstree __trigger, jstree _clean, $.vakata.dnd _execute, $.vakata. context _focus, $.jstree _focused, $.jstree _get_string, jstree _load_node, jstree _parse, $.vakata. context _reference, $.jstree _scroll, $.vakata.dnd _show_submenu, $.vakata. context _trigger A add_css, $.vakata.css add_sheet, $.vakata.css array_remove, $.vakata C clean_node, jstree close_all, jstree close_node, jstree correct_node, jstree D drag, $.vakata.dnd G get_children, jstree get_container, jstree get_container_ul, jstree get_css, $.vakata.css get_index, jstree get_next, jstree get_node, jstree get_parent, jstree get_prev, jstree get_settings, jstree H hide, $.vakata. context I init, jstree is_closed, jstree is_leaf, jstree is_loaded, jstree is_loading, jstree is_locked, jstree is_open, jstree is_parent, jstree L load_node, jstree lock, jstree O open_all, jstree open_node, jstree P plugin, $.jstree R remove_css, $.vakata.css S set_theme, jstree show, $.vakata. context start, $.vakata.dnd stop, $.vakata.dnd T toggle_node, jstree U unlock, jstree V vakata_reverse, $() X xslt, $.vakata - + -Function Index
$#! __call, $.jstree __construct, $.jstree __destruct, $.jstree __trigger, jstree _clean, $.vakata.dnd _execute, $.vakata. context _focus, $.jstree _focused, $.jstree _get_string, jstree _load_node, jstree _parse, $.vakata. context _reference, $.jstree _scroll, $.vakata.dnd _show_submenu, $.vakata. context _trigger A add_css, $.vakata.css add_sheet, $.vakata.css array_remove, $.vakata C clean_node, jstree close_all, jstree close_node, jstree correct_node, jstree D drag, $.vakata.dnd G get_children, jstree get_container, jstree get_container_ul, jstree get_css, $.vakata.css get_index, jstree get_next, jstree get_node, jstree get_parent, jstree get_prev, jstree get_settings, jstree get_state, jstree get_text, jstree H hide, $.vakata. context I init, jstree is_closed, jstree is_leaf, jstree is_loaded, jstree is_loading, jstree is_locked, jstree is_open, jstree is_parent, jstree L load_node, jstree lock, jstree O open_all, jstree open_node, jstree P parse_json, jstree plugin, $.jstree R refresh, jstree remove_css, $.vakata.css S scroll_to_node, jstree set_state, jstree set_text, jstree set_theme, jstree show, $.vakata. context start, $.vakata.dnd stop, $.vakata.dnd T toggle_node, jstree U unlock, jstree V vakata_reverse, $() X xslt, $.vakata Call a function on the instance and return the resultCreates a new jstree instance, any arguments after the first one are merged and used to configure the tree.Destroys an instance, and also clears `jstree-` prefixed classes and all events in the `jstree` namespaceUsed internally to trigger events on the container node.Used internally to cleanup after a drop, so that all variables are nulled and ready for the next drag.Used internally to execute the action (if any) associated with an item.Make an instance focused (which defocuses the previously focused instance)Returns the currently focused instance (by default once an instance is created it is focused)Used to get the common string in the tree.
_get_string : function ( s ) Load the children of a node, but as opposed to load_node does not change any visual properties or trigger events.
_load_node : function ( obj, callback ) Used internally to parse a contextmenu description object to an HTML string.Returns an instanceUsed internally to scroll hovered elements.Used internally to show a submenuUsed internally to trigger all necessary events.@@ -29,59 +29,59 @@ -Used internally to trigger all necessary events.Get all the children of a node
get_children : function ( obj ) Returns the jQuery extended container of the tree (the element you used when constructing the tree).Returns the jQuery extended first UL node inside the container of the tree.Retrieves or deletes a specific rule.Returns an integer, which is the instance’s index.Get the next sibling of a node
get_next : function ( obj, strict ) Get a hold of the LI node (which represents the jstree node).
get_node : function ( obj ) Get the parent of a node
get_parent : function ( obj ) Get the previous sibling of a node
get_prev : function ( obj, strict ) +Returns the settings for the tree.Get all the children of a node
get_children : function ( obj ) Returns the jQuery extended container of the tree (the element you used when constructing the tree).Returns the jQuery extended first UL node inside the container of the tree.Retrieves or deletes a specific rule.Returns an integer, which is the instance’s index.Get the next sibling of a node
get_next : function ( obj, strict ) Get a hold of the LI node (which represents the jstree node).
get_node : function ( obj ) Get the parent of a node
get_parent : function ( obj ) Get the previous sibling of a node
get_prev : function ( obj, strict ) Returns the settings for the tree.This function returns the current state of the tree (as collected from all active plugins).
get_state : function () -This function returns the title of the node.
get_text : function ( obj, remove_html ) +Used internally to hide the contextmenu after a click, or on mouseleave, etc.-Used internally to hide the contextmenu after a click, or on mouseleave, etc.Used internally.Check if a node is currently closed.
is_closed : function ( obj ) Check if a node is a leaf node (has no children).
is_leaf : function ( obj ) Check if a node is loaded.
is_loaded : function ( obj ) Check if a node is currently loading.
is_loading : function ( obj ) Used to get the locked status of the tree.
is_locked : function () Check if a node is currently open.
is_open : function ( obj ) +Check if a node is a parent.
is_parent : function ( obj ) Used internally.Check if a node is currently closed.
is_closed : function ( obj ) Check if a node is a leaf node (has no children).
is_leaf : function ( obj ) Check if a node is loaded.
is_loaded : function ( obj ) Check if a node is currently loading.
is_loading : function ( obj ) Used to get the locked status of the tree.
is_locked : function () Check if a node is currently open.
is_open : function ( obj ) -Check if a node is a parent.
is_parent : function ( obj ) Load the children of a node.+Used to lock the tree.Load the children of a node.-Used to lock the tree.Open all nodes from a certain node down.+Open a node so that its children are visible.Open all nodes from a certain node down.-Open a node so that its children are visible.+Register a pluginThis function returns a jQuery node after parsing a JSON object (a LI node for single elements or an UL node for multiple).
parse_json : function ( node ) -Register a plugin+Removes a rule, this functions is a shortcut to $.vakata.css.get_css with the delete flag set to true.This function saves the current state, reloads the complete tree and returns it to the saved state.-Removes a rule, this functions is a shortcut to $.vakata.css.get_css with the delete flag set to true.Sets the tree theme.
set_theme : function ( theme_name, theme_url ) Shows the context menu.Use this function to start a drag (usually with the mousedown event)+Used internally to process the mouseup event (drop) after $.vakata.dnd.start is called.This function scrolls the container to the desired node (if needed).
scroll_to_node : function ( obj ) This function returns sets the state of the tree.This function sets the title of the node.Sets the tree theme.
set_theme : function ( theme_name, theme_url ) Shows the context menu.Use this function to start a drag (usually with the mousedown event)-Used internally to process the mouseup event (drop) after $.vakata.dnd.start is called.+
toggle_node : function ( obj ) -
toggle_node : function ( obj ) +Used to unlock the tree.-Used to unlock the tree.+Makes it possible to apply the standard array reverse function to a jQuery collection.-Makes it possible to apply the standard array reverse function to a jQuery collection.+This functions transforms a XML string using a XSL string.
$.vakata.xslt = function ( xml, xsl, callback ) This functions transforms a XML string using a XSL string.
$.vakata.xslt = function ( xml, xsl, callback ) diff --git a/_docs/index/General.html b/_docs/index/General.html index c31527ff..937084fc 100644 --- a/_docs/index/General.html +++ b/_docs/index/General.html @@ -11,25 +11,25 @@ -jstreejquery treeview pluginIndex+
$#! $(“#id”) $(array), $(html) $(expr,context) $(function) )), $(expr,$( __after_close, jstree __after_open, jstree __call, $.jstree __construct, $.jstree __destruct, $.jstree __loaded, jstree __trigger, jstree _clean, $.vakata.dnd _execute, $.vakata. context _focus, $.jstree _focused, $.jstree _get_string, jstree _load_node, jstree _parse, $.vakata. context _reference, $.jstree _scroll, $.vakata.dnd _show_submenu, $.vakata. context _trigger A add_css, $.vakata.css add_sheet, $.vakata.css array_remove, $.vakata C clean_node, jstree close_all, jstree close_node, jstree context, $.vakata Context menu context_hide context_menu_item context_parse context_show CORE functions, jstree CORE options, jstree correct_node, jstree css, $.vakata CSS D data, jstree defaults, $.jstree dnd, $.vakata dnd_move dnd_start dnd_stop dots, jstree. config. themes drag, $.vakata.dnd Drag’n’drop G get_children, jstree get_container, jstree get_container_ul, jstree get_css, $.vakata.css get_index, jstree get_next, jstree get_node, jstree get_parent, jstree get_prev, jstree get_settings, jstree H Helper functions helper_left, $.vakata. dnd. settings helper_top, $.vakata. dnd. settings hide, $.vakata. context hide_onmouseleave, $.vakata. context. settings I icons init, jstree is_closed, jstree IS_FF2, $.jstree IS_IE6, $.jstree IS_IE7, $.jstree is_leaf, jstree is_loaded, jstree is_loading, jstree is_locked, jstree is_open, jstree is_parent, jstree J jquery.js jstree jstree UI plugin jstree. core.js jstree. themes.js jstree. ui.js L License load_node, jstree lock, jstree O open_all, jstree open_node, jstree P plugin, $.jstree R remove_css, $.vakata.css S scroll_proximity, $.vakata. dnd. settings scroll_speed, $.vakata. dnd. settings SCROLLBAR_WIDTH, $.jstree set_theme, jstree settings show, $.vakata. context start, $.vakata.dnd stop, $.vakata.dnd strings, jstree. config.core T theme, jstree. config. themes THEMES functions, jstree THEMES options, jstree THEMES_DIR, $.jstree threshold, $.vakata. dnd. settings toggle_node, jstree U unlock, jstree url, jstree. config. themes Usage - + -Index-
$#! __after_close, jstree __after_open, jstree __call, $.jstree __construct, $.jstree __destruct, $.jstree __loaded, jstree __trigger, jstree _clean, $.vakata.dnd _execute, $.vakata. context _focus, $.jstree _focused, $.jstree _get_string, jstree _load_node, jstree _parse, $.vakata. context _reference, $.jstree _scroll, $.vakata.dnd _show_submenu, $.vakata. context _trigger A add_css, $.vakata.css add_sheet, $.vakata.css array_remove, $.vakata C clean_node, jstree close_all, jstree close_node, jstree context, $.vakata Context menu context_hide context_menu_item context_parse context_show CORE functions, jstree CORE options, jstree correct_node, jstree css, $.vakata CSS D data, jstree defaults, $.jstree dnd, $.vakata dnd_move dnd_start dnd_stop dots, jstree. config. themes drag, $.vakata.dnd Drag’n’drop G get_children, jstree get_container, jstree get_container_ul, jstree get_css, $.vakata.css get_index, jstree get_next, jstree get_node, jstree get_parent, jstree get_prev, jstree get_settings, jstree get_state, jstree get_text, jstree H Helper functions helper_left, $.vakata. dnd. settings helper_top, $.vakata. dnd. settings hide, $.vakata. context hide_onmouseleave, $.vakata. context. settings I icons init, jstree is_closed, jstree IS_FF2, $.jstree IS_IE6, $.jstree IS_IE7, $.jstree is_leaf, jstree is_loaded, jstree is_loading, jstree is_locked, jstree is_open, jstree is_parent, jstree J jstree jstree UI plugin jstree. core.js jstree. themes.js jstree. ui.js L License load_node, jstree lock, jstree O open_all, jstree open_node, jstree P parse_json, jstree plugin, $.jstree R refresh, jstree remove_css, $.vakata.css S scroll_proximity, $.vakata. dnd. settings scroll_speed, $.vakata. dnd. settings scroll_to_node, jstree SCROLLBAR_WIDTH, $.jstree set_state, jstree set_text, jstree set_theme, jstree settings show, $.vakata. context start, $.vakata.dnd stop, $.vakata.dnd strings, jstree. config.core (which is just equivalent to: $(context).find(expr)Shortcut for document readyThis event is triggered in the jstree namespace when a node is closed AFTER the animation completes).This event is triggered in the jstree namespace when a node is successfully opened AFTER the animation completes).Call a function on the instance and return the resultCreates a new jstree instance, any arguments after the first one are merged and used to configure the tree.Destroys an instance, and also clears `jstree-` prefixed classes and all events in the `jstree` namespaceThis event is triggered in the jstree namespace when data is first rendered in the tree.Used internally to trigger events on the container node.Used internally to cleanup after a drop, so that all variables are nulled and ready for the next drag.Used internally to execute the action (if any) associated with an item.Make an instance focused (which defocuses the previously focused instance)Returns the currently focused instance (by default once an instance is created it is focused)Used to get the common string in the tree.
_get_string : function ( s ) Load the children of a node, but as opposed to load_node does not change any visual properties or trigger events.
_load_node : function ( obj, callback ) Used internally to parse a contextmenu description object to an HTML string.Returns an instanceUsed internally to scroll hovered elements.Used internally to show a submenuUsed internally to trigger all necessary events.+Used internally to trigger all necessary events.This event is triggered in the jstree namespace when a node is closed AFTER the animation completes).This event is triggered in the jstree namespace when a node is successfully opened AFTER the animation completes).Call a function on the instance and return the resultCreates a new jstree instance, any arguments after the first one are merged and used to configure the tree.Destroys an instance, and also clears `jstree-` prefixed classes and all events in the `jstree` namespaceThis event is triggered in the jstree namespace when data is first rendered in the tree.Used internally to trigger events on the container node.Used internally to cleanup after a drop, so that all variables are nulled and ready for the next drag.Used internally to execute the action (if any) associated with an item.Make an instance focused (which defocuses the previously focused instance)Returns the currently focused instance (by default once an instance is created it is focused)Used to get the common string in the tree.
_get_string : function ( s ) Load the children of a node, but as opposed to load_node does not change any visual properties or trigger events.
_load_node : function ( obj, callback ) Used internally to parse a contextmenu description object to an HTML string.Returns an instanceUsed internally to scroll hovered elements.Used internally to show a submenuUsed internally to trigger all necessary events.-Used internally to trigger all necessary events.Adds a rule.Adds a whole stylesheet or appends to an existing stylesheet.+Makes it possible to remove an item (or a group of items) form an array.
$.vakata.array_remove = function( array, from, to ) Adds a rule.Adds a whole stylesheet or appends to an existing stylesheet.-Makes it possible to remove an item (or a group of items) form an array.
$.vakata.array_remove = function( array, from, to ) This function converts inserted nodes to the required by jsTree format.
clean_node : function ( obj ) Close all nodes from a certain node down.Close a node so that its children are not visible.object holds all context menu related functions and variables.
$.vakata.context Functions needed to show a custom context menu.Triggered when the context menu is hidden.object Used to construct a context menu entry, this structure will always be a part of an object.Triggered when the context menu is parsed but not yet shown.Triggered when the context menu is shown.This function corrects the open/closed/leaf state as data changes (as the user interacts with the tree).object holds all CSS related functions
$.vakata.css +Functions needed to manipulate stylesheets (add, remove, change)This function converts inserted nodes to the required by jsTree format.
clean_node : function ( obj ) Close all nodes from a certain node down.Close a node so that its children are not visible.object holds all context menu related functions and variables.
$.vakata.context Functions needed to show a custom context menu.Triggered when the context menu is hidden.object Used to construct a context menu entry, this structure will always be a part of an object.Triggered when the context menu is parsed but not yet shown.Triggered when the context menu is shown.This function corrects the open/closed/leaf state as data changes (as the user interacts with the tree).object holds all CSS related functions
$.vakata.css -Functions needed to manipulate stylesheets (add, remove, change)object Provides storage for plugins (aside from private variables).object storing all the default configuration options for every plugin and the core.object holds all DND related functions
$.vakata.dnd Triggered multiple times while dragging.Marks the start of the drag.Marks the end of the drag.boolean whether to show dots or not.Used internally to process the mousemove event after $.vakata.dnd.start is called.+Functions needed to drag’n’drop elementsobject Provides storage for plugins (aside from private variables).object storing all the default configuration options for every plugin and the core.object holds all DND related functions
$.vakata.dnd Triggered multiple times while dragging.Marks the start of the drag.Marks the end of the drag.boolean whether to show dots or not.Used internally to process the mousemove event after $.vakata.dnd.start is called.-Functions needed to drag’n’drop elementsGet all the children of a node
get_children : function ( obj ) Returns the jQuery extended container of the tree (the element you used when constructing the tree).Returns the jQuery extended first UL node inside the container of the tree.Retrieves or deletes a specific rule.Returns an integer, which is the instance’s index.Get the next sibling of a node
get_next : function ( obj, strict ) Get a hold of the LI node (which represents the jstree node).
get_node : function ( obj ) Get the parent of a node
get_parent : function ( obj ) Get the previous sibling of a node
get_prev : function ( obj, strict ) +Returns the settings for the tree.Get all the children of a node
get_children : function ( obj ) Returns the jQuery extended container of the tree (the element you used when constructing the tree).Returns the jQuery extended first UL node inside the container of the tree.Retrieves or deletes a specific rule.Returns an integer, which is the instance’s index.Get the next sibling of a node
get_next : function ( obj, strict ) Get a hold of the LI node (which represents the jstree node).
get_node : function ( obj ) Get the parent of a node
get_parent : function ( obj ) Get the previous sibling of a node
get_prev : function ( obj, strict ) Returns the settings for the tree.This function returns the current state of the tree (as collected from all active plugins).
get_state : function () @@ -53,31 +53,23 @@ -This function returns the title of the node.
get_text : function ( obj, remove_html ) +Register a pluginThis function returns a jQuery node after parsing a JSON object (a LI node for single elements or an UL node for multiple).
parse_json : function ( node ) -Register a plugin+Removes a rule, this functions is a shortcut to $.vakata.css.get_css with the delete flag set to true.This function saves the current state, reloads the complete tree and returns it to the saved state.-Removes a rule, this functions is a shortcut to $.vakata.css.get_css with the delete flag set to true.integer number of pixels from the edge of a scrollable parent below which the parent will start scrolling.integer how fast (pixel count for each step) should a scrollable parent scroll when dragging near the edge.integer indicating the width of the client scrollbar
$.jstree.SCROLLBAR_WIDTH Sets the tree theme.
set_theme : function ( theme_name, theme_url ) object holds the global settings object for context menus.object holds the global settings object for DND.Shows the context menu.Use this function to start a drag (usually with the mousedown event)Used internally to process the mouseup event (drop) after $.vakata.dnd.start is called.- - - -mixed used to store all localization strings.string the name of the theme you want to use.The location of all themes, this is used when setting a theme without supplying an URL (only by name).
$.jstree.THEMES_DIR integer amount of pixels required to move before the drag is started.- - - -
toggle_node : function ( obj ) Used to unlock the tree.mixed the URL of the stylesheet of the theme you want to use.+Introductioninteger number of pixels from the edge of a scrollable parent below which the parent will start scrolling.integer how fast (pixel count for each step) should a scrollable parent scroll when dragging near the edge.This function scrolls the container to the desired node (if needed).
scroll_to_node : function ( obj ) integer indicating the width of the client scrollbar
$.jstree.SCROLLBAR_WIDTH This function returns sets the state of the tree.This function sets the title of the node.Sets the tree theme.
set_theme : function ( theme_name, theme_url ) object holds the global settings object for context menus.object holds the global settings object for DND.Shows the context menu.Use this function to start a drag (usually with the mousedown event)Used internally to process the mouseup event (drop) after $.vakata.dnd.start is called.mixed used to store all localization strings.diff --git a/_docs/index/General2.html b/_docs/index/General2.html index 791c96aa..94a03b44 100644 --- a/_docs/index/General2.html +++ b/_docs/index/General2.html @@ -11,21 +11,29 @@ -jstreejquery treeview pluginIndex+
V vakata, $ vakata_reverse, $() Variables X xslt, $.vakata XSLT - + -Index-
T theme, jstree. config. themes THEMES functions, jstree THEMES options, jstree THEMES_DIR, $.jstree threshold, $.vakata. dnd. settings toggle_node, jstree U unlock, jstree url, jstree. config. themes Usage V vakata, $ vakata_reverse, $() VERSION, $.jstree X xslt, $.vakata XSLT object Holds all helper objects.
$.vakata +Makes it possible to apply the standard array reverse function to a jQuery collection.string the name of the theme you want to use.The location of all themes, this is used when setting a theme without supplying an URL (only by name).
$.jstree.THEMES_DIR integer amount of pixels required to move before the drag is started.-
toggle_node : function ( obj ) This functions transforms a XML string using a XSL string.
$.vakata.xslt = function ( xml, xsl, callback ) +A function used to do XSLT transformations.Used to unlock the tree.mixed the URL of the stylesheet of the theme you want to use.+ + + +Introductionobject Holds all helper objects.
$.vakata Makes it possible to apply the standard array reverse function to a jQuery collection.+ + + +string the version of jstreeThis functions transforms a XML string using a XSL string.
$.vakata.xslt = function ( xml, xsl, callback ) A function used to do XSLT transformations.diff --git a/_docs/index/Variables.html b/_docs/index/Variables.html index 48725a56..e8478d00 100644 --- a/_docs/index/Variables.html +++ b/_docs/index/Variables.html @@ -11,49 +11,45 @@ -jstreejquery treeview pluginVariable Index+
$#! $(“#id”) $(array), $(html) $(expr,context) $(function) )), $(expr,$( C context, $.vakata context_menu_item css, $.vakata D data, jstree defaults, $.jstree dnd, $.vakata dots, jstree. config. themes H helper_left, $.vakata. dnd. settings helper_top, $.vakata. dnd. settings hide_onmouseleave, $.vakata. context. settings I icons IS_FF2, $.jstree IS_IE6, $.jstree IS_IE7, $.jstree S scroll_proximity, $.vakata. dnd. settings scroll_speed, $.vakata. dnd. settings SCROLLBAR_WIDTH, $.jstree settings strings, jstree. config.core T theme, jstree. config. themes THEMES_DIR, $.jstree threshold, $.vakata. dnd. settings U url, jstree. config. themes V vakata, $ - + -Variable Index-
C context, $.vakata context_menu_item css, $.vakata D data, jstree defaults, $.jstree dnd, $.vakata dots, jstree. config. themes H helper_left, $.vakata. dnd. settings helper_top, $.vakata. dnd. settings hide_onmouseleave, $.vakata. context. settings I icons IS_FF2, $.jstree IS_IE6, $.jstree IS_IE7, $.jstree S scroll_proximity, $.vakata. dnd. settings scroll_speed, $.vakata. dnd. settings SCROLLBAR_WIDTH, $.jstree settings strings, jstree. config.core T theme, jstree. config. themes THEMES_DIR, $.jstree threshold, $.vakata. dnd. settings U url, jstree. config. themes V vakata, $ VERSION, $.jstree (which is just equivalent to: $(context).find(expr)+Shortcut for document readyobject holds all context menu related functions and variables.
$.vakata.context object Used to construct a context menu entry, this structure will always be a part of an object.-object holds all CSS related functions
$.vakata.css object holds all context menu related functions and variables.
$.vakata.context object Used to construct a context menu entry, this structure will always be a part of an object.+object holds all CSS related functions
$.vakata.css object Provides storage for plugins (aside from private variables).object storing all the default configuration options for every plugin and the core.object holds all DND related functions
$.vakata.dnd -boolean whether to show dots or not.object Provides storage for plugins (aside from private variables).object storing all the default configuration options for every plugin and the core.object holds all DND related functions
$.vakata.dnd +boolean whether to show dots or not.integer number of pixels left of the cursor to move the drag-helper to.integer number of pixels below the cursor to move the drag-helper to.-integer the amount of milliseconds to wait before hiding the menu after mouseleave.integer number of pixels left of the cursor to move the drag-helper to.integer number of pixels below the cursor to move the drag-helper to.+integer the amount of milliseconds to wait before hiding the menu after mouseleave.boolean whether to show icons or not.boolean whether to show icons or not.boolean indicating if the client is running Firefox 2boolean indicating if the client is running Internet Explorer 6-boolean indicating if the client is running Internet Explorer 7boolean whether to show icons or not.boolean whether to show icons or not.boolean indicating if the client is running Firefox 2boolean indicating if the client is running Internet Explorer 6+boolean indicating if the client is running Internet Explorer 7integer number of pixels from the edge of a scrollable parent below which the parent will start scrolling.integer how fast (pixel count for each step) should a scrollable parent scroll when dragging near the edge.integer indicating the width of the client scrollbar
$.jstree.SCROLLBAR_WIDTH object holds the global settings object for context menus.object holds the global settings object for DND.-mixed used to store all localization strings.integer number of pixels from the edge of a scrollable parent below which the parent will start scrolling.integer how fast (pixel count for each step) should a scrollable parent scroll when dragging near the edge.integer indicating the width of the client scrollbar
$.jstree.SCROLLBAR_WIDTH object holds the global settings object for context menus.object holds the global settings object for DND.+mixed used to store all localization strings.string the name of the theme you want to use.The location of all themes, this is used when setting a theme without supplying an URL (only by name).
$.jstree.THEMES_DIR -integer amount of pixels required to move before the drag is started.string the name of the theme you want to use.The location of all themes, this is used when setting a theme without supplying an URL (only by name).
$.jstree.THEMES_DIR +integer amount of pixels required to move before the drag is started.-mixed the URL of the stylesheet of the theme you want to use.- - - -mixed the URL of the stylesheet of the theme you want to use.+object Holds all helper objects.
$.vakata object Holds all helper objects.
$.vakata string the version of jstreediff --git a/_docs/javascript/searchdata.js b/_docs/javascript/searchdata.js index 07c9369e..1f86a3a6 100644 --- a/_docs/javascript/searchdata.js +++ b/_docs/javascript/searchdata.js @@ -30,7 +30,7 @@ var indexSectionsWithContent = { "Z": false }, "Variables": { - "Symbols": true, + "Symbols": false, "Numbers": false, "A": false, "B": false, diff --git a/_docs/search/FilesJ.html b/_docs/search/FilesJ.html index d3b2b35c..1d14a64f 100644 --- a/_docs/search/FilesJ.html +++ b/_docs/search/FilesJ.html @@ -11,7 +11,7 @@ -jstreejquery treeview pluginLoading...Searching...No Matches+ +Then you need to include jstree itself +> + +You may change the path to whatever you like, but it is recommended not to rename _jquery.tree.js_ (or _jquery.tree.min.js_) as the filename may be used for path autodetection (for example in theplugin, however all official plugins will provide an alternative way of specifying any needed path manually). + +Additionally some plugins have dependencies. If a plugin detects that a dependency is missing, it will throw an error. + +*Creating and configuring an instance* + +You can create a tree in the following manner (<$().jstree>) : +>jQuery("some-selector-to-container-node-here").jstree([ config_object ]); + +In the optional config object you specify all the options that you want to set. Each plugin will describe its configuration and defaults. Each plugin's options (even the core) are set in their own subobject, which is named after the plugin. For example all of the core's options are set in the _core_ key of the config object. +>jQuery("some-selector-to-container-node-here") +> .jstree({ +> core : { +> /* core options go here */ +> } +> }); + +*Please note that if your options for a given plugin are the same as the defaults you may omit those options or omit the subobject completely (if you do not need to modify the defaults).* + +The special _plugins_ config option is not part of any plugin, it defines a list of active plugins for the instance being created. +Although many plugins may be included, only the ones listed in this option will be active. +>jQuery("some-selector-to-container-node-here") +> .jstree({ +> core : { /* core options go here */ }, +> plugins : [ "themes", "html_data", "some-other-plugin" ] +> }); + +*Interacting with the tree* + +To perform an operation programatically on a given instance you can use two methods (<$().jstree>, <$.jstree._reference>). +>/* METHOD ONE */ +>jQuery("some-selector-to-container-node-here") +> .jstree("operation_name" [, argument_1, argument_2, ...]); +> +>/* METHOD TWO */ +>jQuery.jstree._reference(needle) +> .operation_name([ argument_1, argument_2, ...]); + + +*Events* + +jsTree uses events to notify of any changes happening in the tree. All events fire on the tree container in the _jstree_ namespace and are named after the function that triggered them. +Personally I believe it is best to bind to the events and then create the instance. + +>jQuery("some-container") +> .bind("loaded.jstree", function (event, data) { +> alert("TREE IS LOADED"); +> }) +> .jstree({ /* configuration here */ }); + +Please note the second parameter data. Read the documentation on each event to see what it contains. + +*Data* + +TODO: a step by step guide to: HTML (no data plugin), HTML with plugin + AJAX, JSON, JSON + AJAX, XML, XML + AJAX +TODO: progressive render / unload + +*States* + +TODO: explain about passing states along with the data and the special data-jstree- attributes. diff --git a/jstree.core.js b/jstree.core.js index 499f85e4..8cd6a62e 100644 --- a/jstree.core.js +++ b/jstree.core.js @@ -36,6 +36,11 @@ Some static functions and variables, unless you know exactly what you are doing *object* Contains all static functions and variables used by jstree, some plugins also append variables. */ $.jstree = { + /* + Variable: $.jstree.VERSION + *string* the version of jstree + */ + VERSION : '1.0', /* Variable: $.jstree.IS_IE6 *boolean* indicating if the client is running Internet Explorer 6 @@ -1114,6 +1119,14 @@ Some static functions and variables, unless you know exactly what you are doing }); return obj; }, + /* + Function: scroll_to_node + This function scrolls the container to the desired node (if needed). + + Parameters: + obj - *mixed* this is used as a jquery selector - can be jQuery object, DOM node, string, etc. + + */ scroll_to_node : function (obj) { var c = this.get_container()[0], t; if(c.scrollHeight > c.offsetHeight) { @@ -1128,12 +1141,63 @@ Some static functions and variables, unless you know exactly what you are doing } } }, + /* + Function: get_state + This function returns the current state of the tree (as collected from all active plugins). + Plugin authors: pay special attention to the way this function is extended for new plugins. In your plugin code write: + > get_state : function () { + > var state = this.__call_old(); + > state.your-plugin-name = ; + > return state; + > } + Returns: + object - the current state of the instance + */ get_state : function () { // TODO: scroll position, theme var state = { 'open' : [], 'scroll' : { 'left' : this.get_container().scrollLeft(), 'top' : this.get_container().scrollTop() } }; this.get_container_ul().find('.jstree-open').each(function () { if(this.id) { state.open.push(this.id); } }); return state; }, + /* + Function: set_state + This function returns sets the state of the tree. + Plugin authors: pay special attention to the way this function is extended for new plugins. In your plugin code write: + > set_state : function (state, callback) { + > if(this.__call_old()) { + > if(state.your-plugin-name) { + > + > // restore using `state.your-plugin-name` + > // if you need some async activity so that you return to this bit of code + > // do not delete state.your-plugin-name and return false (see core's function for example) + > + > delete state.your-plugin-name; + > this.set_state(state, callback); + > return false; + > } + > return true; + > } + > return false; + > } + + Parameters: + state - *object* the state to restore to + callback - *function* this will be executed in the instance's scope once restoring is done + + Returns: + boolean - the return value is used to determine the phase of restoration + + Triggers: + + + Event: set_state + This event is triggered in the *jstree* namespace when a set_state call completes. + + Parameters: + data.inst - the instance + data.args - *array* the arguments passed to the function + data.plugin - *string* the function's plugin (here it will be _"core"_ but if the function is extended it may be something else) + */ set_state : function (state, callback) { if(state) { if($.isArray(state.open)) { @@ -1183,6 +1247,19 @@ Some static functions and variables, unless you know exactly what you are doing } return false; }, + /* + Function: refresh + This function saves the current state, reloads the complete tree and returns it to the saved state. + + Triggers: + + + Event: refresh + This event is triggered in the *jstree* namespace when a refresh call completes. + + Parameters: + data.inst - the instance + */ refresh : function () { this.data.core.state = this.get_state(); this.load_node(-1, function (o, s) { @@ -1192,7 +1269,17 @@ Some static functions and variables, unless you know exactly what you are doing this.data.core.state = null; }); }, + /* + Function: get_text + This function returns the title of the node. + Parameters: + obj - *mixed* this is used as a jquery selector - can be jQuery object, DOM node, string, etc. + remove_html - *boolean* set to _true_ to return plain text instead of HTML + + Returns: + string - the title of the node, specified by _obj_ + */ get_text : function (obj, remove_html) { obj = this.get_node(obj); if(!obj || obj === -1 || !obj.length) { return false; } @@ -1200,6 +1287,35 @@ Some static functions and variables, unless you know exactly what you are doing obj.children(".jstree-icon").remove(); return obj[ remove_html ? 'text' : 'html' ](); }, + /* + Function: set_text + This function sets the title of the node. This is a low-level function, you'd be better off using . + + Parameters: + obj - *mixed* this is used as a jquery selector - can be jQuery object, DOM node, string, etc. + val - *string* the new title of the node (can be HTMl too) + + Returns: + boolean - was the rename successfull + + Triggers: + + + Event: set_text + This event is triggered in the *jstree* namespace when a set_text call completes. + + Parameters: + data.inst - the instance + data.args - *array* the arguments passed to the function + data.plugin - *string* the function's plugin (here it will be _"core"_ but if the function is extended it may be something else) + data.rslt - *object* which contains a two key: _obj_ (the node) and _val_ (the new title). + + Example: + > $("div").bind("set_text.jstree", function (e, data) { + > alert("Renamed to: " + data.rslt.val); + > }); + + */ set_text : function (obj, val) { obj = this.get_node(obj); if(!obj || obj === -1 || !obj.length) { return false; } @@ -1209,7 +1325,28 @@ Some static functions and variables, unless you know exactly what you are doing this.__callback({ "obj" : obj, "text" : val }); return true; }, + /* + Function: parse_json + This function returns a jQuery node after parsing a JSON object (a LI node for single elements or an UL node for multiple). This function will use the default title from _jstree.config.core.strings_ if none is specified. + Parameters: + node - *mixed* the input to parse + > // can be a string + > "The title of the parsed node" + > // array of strings + > [ "Node 1", "Node 2" ] + > // an object + > { "title" : "The title of the parsed node" } + > // you can manipulate the output + > { "title" : "The title of the parsed node", "li_attr" : { "id" : "id_for_li" }, "a_attr" : { "href" : "http://jstree.com" } } + > // you can supply metadata, which you can later access using $(the_li_node).data() + > { "title" : "The title of the parsed node", "data" : { } } + > // you can supply children (they can be objects too) + > { "title" : "The title of the parsed node", "children" : [ "Node 1", { "title" : "Node 2" } ] } + + Returns: + jQuery - the LI (or UL) node which was produced from the JSON + */ parse_json : function (node) { var li, a, ul, t; if($.isArray(node)) {