Interface JSTreeStaticDefaultsCore

Index

Properties

Properties

optional public animation?: any

the open / close animation duration in milliseconds - set this to false to disable the animation (default is 200)

name

$.jstree.defaults.core.animation

optional public check_callback?: any

determines what happens when a user tries to modify the structure of the tree If left as false all operations like create, rename, delete, move or copy are prevented. You can set this to true to allow all interactions or use a function to have better control.

Examples

$('#tree').jstree({
    'core' : {
        'check_callback' : function (operation, node, node_parent, node_position, more) {
            // operation can be 'create_node', 'rename_node', 'delete_node', 'move_node' or 'copy_node'
            // in case of 'rename_node' node_position is filled with the new node name
            return operation === 'rename_node' ? true : false;
        }
    }
});
name

$.jstree.defaults.core.check_callback

optional public data?: any

data configuration

If left as false the HTML inside the jstree container element is used to populate the tree (that should be an unordered list with list items).

You can also pass in a HTML string or a JSON array here.

It is possible to pass in a standard jQuery-like AJAX config and jstree will automatically determine if the response is JSON or HTML and use that to populate the tree. In addition to the standard jQuery ajax options here you can suppy functions for data and url, the functions will be run in the current instance's scope and a param will be passed indicating which node is being loaded, the return value of those functions will be used.

The last option is to specify a function, that function will receive the node being loaded as argument and a second param which is a function which should be called with the result.

Examples

// AJAX
$('#tree').jstree({
    'core' : {
        'data' : {
            'url' : '/get/children/',
            'data' : function (node) {
                return { 'id' : node.id };
            }
        }
    });

// direct data
$('#tree').jstree({
    'core' : {
        'data' : [
            'Simple root node',
            {
                'id' : 'node_2',
                'text' : 'Root node with options',
                'state' : { 'opened' : true, 'selected' : true },
                'children' : [ { 'text' : 'Child 1' }, 'Child 2']
            }
        ]
    });

// function
$('#tree').jstree({
    'core' : {
        'data' : function (obj, callback) {
            callback.call(this, ['Root 1', 'Root 2']);
        }
    });
name

$.jstree.defaults.core.data

public error: () => any

a callback called with a single object parameter in the instance's scope when something goes wrong (operation prevented, ajax failed, etc)

name

$.jstree.defaults.core.error

optional public expand_selected_onload?: boolean

if left as true all parents of all selected nodes will be opened once the tree loads (so that all selected nodes are visible to the user)

name

$.jstree.defaults.core.expand_selected_onload

optional public multiple?: boolean

a boolean indicating if multiple nodes can be selected

name

$.jstree.defaults.core.multiple

optional public strings?: any

configure the various strings used throughout the tree

You can use an object where the key is the string you need to replace and the value is your replacement. Another option is to specify a function which will be called with an argument of the needed string and should return the replacement. If left as false no replacement is made.

Examples

$('#tree').jstree({
    'core' : {
        'strings' : {
            'Loading...' : 'Please wait ...'
        }
    }
});
name

$.jstree.defaults.core.strings

optional public themes?: JSTreeStaticDefaultsCoreThemes

theme configuration object

name

$.jstree.defaults.core.themes