Shimmy Weitzhandler
Shimmy Weitzhandler

Reputation: 104721

Usage of jsTree functions

I'm looking at the jsTree plugin API, and can't understand where the API functions (set_theme, show_dots etc.) are to be used.

I see in this page some functions preceded by jQuery, whilst some are preceeded by a dot, how do these two types of functions defer? How do I use the latter?

Upvotes: 0

Views: 3386

Answers (1)

Mortalus
Mortalus

Reputation: 10712

There are 2 ways to call a function on the tree instance of the jsTree plugin:

/* METHOD ONE */
jQuery("some-selector-to-container-node-here")
    .jstree("operation_name" [, argument_1, argument_2, ...]);

/* METHOD TWO */
jQuery.jstree._reference(needle) 
    /* NEEDLE can be a DOM node or selector for the container or a node within the container */
    .operation_name([ argument_1, argument_2, ...]);

refer to this documentation page for more info: http://www.jstree.com/documentation/core

so when you see this: .set_theme ( name , url ) in the docs it means that you can use it like that:

/* METHOD ONE */
$('#treeContainer').jstree("set_theme ","ThemeName","\PathToTheme\Here");

/* METHOD TWO */
var $MYjsTreeObj = $('#treeContainer').jstree({...});
jQuery.jstree._reference($MYjsTreeObj).set_theme ("ThemeName","\PathToTheme\Here");

Upvotes: 6

Related Questions