jqtree 1.8.2 → 1.8.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bower.json +1 -1
- package/package.json +31 -29
- package/src/dragAndDropHandler/generateHitAreas.ts +47 -43
- package/src/nodeElement/ghostDropHint.ts +3 -37
- package/src/nodeElement/index.ts +1 -1
- package/src/saveStateHandler.ts +43 -59
- package/src/version.ts +1 -1
- package/tree.jquery.debug.js +69 -106
- package/tree.jquery.debug.js.map +1 -1
- package/tree.jquery.js +2 -2
- package/tree.jquery.js.map +1 -1
- package/.editorconfig +0 -12
- package/.eslintrc +0 -48
- package/.github/workflows/ci.yml +0 -68
- package/.github/workflows/codeql-analysis.yml +0 -32
- package/.github/workflows/size.yml +0 -24
- package/.github/workflows/static.yml +0 -57
- package/.prettier +0 -3
- package/config/.postcssrc +0 -6
- package/config/babel.config.json +0 -11
- package/config/babel.coverage.config.json +0 -4
- package/config/jest.config.js +0 -24
- package/config/jest.polyfills.js +0 -14
- package/config/playwright.config.js +0 -18
- package/config/production +0 -6
- package/config/rollup.config.mjs +0 -71
- package/css/jqtree.postcss +0 -193
- package/devserver/devserver.js +0 -7
- package/devserver/devserver_scroll.js +0 -8
- package/devserver/index.html +0 -22
- package/devserver/test_index.html +0 -22
- package/devserver/test_scroll.html +0 -28
- package/devserver/test_scroll_container.html +0 -39
- package/docs/.ruby-version +0 -1
- package/docs/Gemfile +0 -5
- package/docs/Gemfile.lock +0 -82
- package/docs/_config.yml +0 -126
- package/docs/_entries/events/index.md +0 -6
- package/docs/_entries/events/tree-click.md +0 -37
- package/docs/_entries/events/tree-close.md +0 -15
- package/docs/_entries/events/tree-contextmenu.md +0 -21
- package/docs/_entries/events/tree-dblclick.md +0 -19
- package/docs/_entries/events/tree-init.md +0 -15
- package/docs/_entries/events/tree-load-data.md +0 -15
- package/docs/_entries/events/tree-loading-data.md +0 -27
- package/docs/_entries/events/tree-move.md +0 -73
- package/docs/_entries/events/tree-open.md +0 -15
- package/docs/_entries/events/tree-refresh.md +0 -12
- package/docs/_entries/events/tree-select.md +0 -28
- package/docs/_entries/functions/addnodeafter.md +0 -20
- package/docs/_entries/functions/addnodebefore.md +0 -8
- package/docs/_entries/functions/addparentnode.md +0 -20
- package/docs/_entries/functions/appendnode.md +0 -50
- package/docs/_entries/functions/closenode.md +0 -23
- package/docs/_entries/functions/destroy.md +0 -12
- package/docs/_entries/functions/getnodebycallback.md +0 -24
- package/docs/_entries/functions/getnodebyhtmlelement.md +0 -29
- package/docs/_entries/functions/getnodebyid.md +0 -21
- package/docs/_entries/functions/getselectednode.md +0 -10
- package/docs/_entries/functions/getstate.md +0 -19
- package/docs/_entries/functions/gettree.md +0 -12
- package/docs/_entries/functions/index.md +0 -6
- package/docs/_entries/functions/is-node-selected.md +0 -11
- package/docs/_entries/functions/isdragging.md +0 -12
- package/docs/_entries/functions/loaddata.md +0 -46
- package/docs/_entries/functions/loaddatafromurl.md +0 -55
- package/docs/_entries/functions/movedown.md +0 -8
- package/docs/_entries/functions/movenode.md +0 -15
- package/docs/_entries/functions/moveup.md +0 -8
- package/docs/_entries/functions/opennode.md +0 -44
- package/docs/_entries/functions/prependnode.md +0 -21
- package/docs/_entries/functions/refresh.md +0 -12
- package/docs/_entries/functions/reload.md +0 -22
- package/docs/_entries/functions/removenode.md +0 -12
- package/docs/_entries/functions/scrolltonode.md +0 -13
- package/docs/_entries/functions/selectnode.md +0 -45
- package/docs/_entries/functions/setoption.md +0 -12
- package/docs/_entries/functions/setstate.md +0 -8
- package/docs/_entries/functions/toggle.md +0 -25
- package/docs/_entries/functions/tojson.md +0 -13
- package/docs/_entries/functions/updatenode.md +0 -50
- package/docs/_entries/general/changelog.md +0 -434
- package/docs/_entries/general/demo.html +0 -28
- package/docs/_entries/general/downloads.md +0 -9
- package/docs/_entries/general/examples.md +0 -8
- package/docs/_entries/general/features.md +0 -15
- package/docs/_entries/general/index.md +0 -7
- package/docs/_entries/general/introduction.md +0 -9
- package/docs/_entries/general/requirements.md +0 -6
- package/docs/_entries/general/tutorial.md +0 -71
- package/docs/_entries/general/usecases.md +0 -15
- package/docs/_entries/multiple_selection/add-to-selection.md +0 -21
- package/docs/_entries/multiple_selection/get-selected-nodes.md +0 -10
- package/docs/_entries/multiple_selection/index.md +0 -9
- package/docs/_entries/multiple_selection/remove-from-selection.md +0 -11
- package/docs/_entries/node/children.md +0 -12
- package/docs/_entries/node/getdata.md +0 -17
- package/docs/_entries/node/getlevel.md +0 -13
- package/docs/_entries/node/getnextnode.md +0 -12
- package/docs/_entries/node/getnextsibling.md +0 -10
- package/docs/_entries/node/getnextvisiblenode.md +0 -15
- package/docs/_entries/node/getpreviousnode.md +0 -12
- package/docs/_entries/node/getprevioussibling.md +0 -10
- package/docs/_entries/node/getpreviousvisiblenode.md +0 -15
- package/docs/_entries/node/index.md +0 -13
- package/docs/_entries/node/parent.md +0 -10
- package/docs/_entries/options/animationspeed.md +0 -7
- package/docs/_entries/options/autoescape.md +0 -6
- package/docs/_entries/options/autoopen.md +0 -28
- package/docs/_entries/options/buttonleft.md +0 -12
- package/docs/_entries/options/closedicon.md +0 -26
- package/docs/_entries/options/data-url.md +0 -45
- package/docs/_entries/options/data.md +0 -46
- package/docs/_entries/options/datafilter.md +0 -17
- package/docs/_entries/options/draganddrop.md +0 -18
- package/docs/_entries/options/index.md +0 -6
- package/docs/_entries/options/keyboardsupport.md +0 -14
- package/docs/_entries/options/oncanmove.md +0 -22
- package/docs/_entries/options/oncanmoveto.md +0 -22
- package/docs/_entries/options/oncanselectnode.md +0 -26
- package/docs/_entries/options/oncreateli.md +0 -22
- package/docs/_entries/options/ondragmove.md +0 -20
- package/docs/_entries/options/ondragstop.md +0 -20
- package/docs/_entries/options/onismovehandle.md +0 -17
- package/docs/_entries/options/onloadfailed.md +0 -15
- package/docs/_entries/options/onloading.md +0 -22
- package/docs/_entries/options/openedicon.md +0 -26
- package/docs/_entries/options/openfolderdelay.md +0 -15
- package/docs/_entries/options/rtl.md +0 -18
- package/docs/_entries/options/savestate.md +0 -39
- package/docs/_entries/options/selectable.md +0 -18
- package/docs/_entries/options/showemptyfolder.md +0 -26
- package/docs/_entries/options/slide.md +0 -12
- package/docs/_entries/options/start_dnd_delay.md +0 -13
- package/docs/_entries/options/tabindex.md +0 -14
- package/docs/_entries/options/usecontextmenu.md +0 -14
- package/docs/_examples/01_load_json_data.html +0 -45
- package/docs/_examples/02_load_json_data_from_server.html +0 -29
- package/docs/_examples/03_drag_and_drop.html +0 -42
- package/docs/_examples/04_save_state.html +0 -46
- package/docs/_examples/05_load_on_demand.html +0 -68
- package/docs/_examples/06_autoescape.html +0 -45
- package/docs/_examples/07_autoscroll.html +0 -42
- package/docs/_examples/08_multiple_select.html +0 -60
- package/docs/_examples/09_custom_html.html +0 -61
- package/docs/_examples/10_icon_buttons.html +0 -26
- package/docs/_examples/11_right-to-left.html +0 -25
- package/docs/_examples/12_button_on_right.html +0 -26
- package/docs/_examples/13_drag_outside.html +0 -48
- package/docs/_examples/14_filter.html +0 -111
- package/docs/_layouts/example.html +0 -7
- package/docs/_layouts/page.html +0 -26
- package/docs/documentation.css +0 -3
- package/docs/index.html +0 -65
- package/docs/package.json +0 -22
- package/docs/pnpm-lock.yaml +0 -892
- package/docs/postcss.config.js +0 -7
- package/docs/static/bower.json +0 -8
- package/docs/static/bower_components/fontawesome/css/all.min.css +0 -9
- package/docs/static/bower_components/fontawesome/webfonts/fa-brands-400.ttf +0 -0
- package/docs/static/bower_components/fontawesome/webfonts/fa-brands-400.woff2 +0 -0
- package/docs/static/bower_components/fontawesome/webfonts/fa-regular-400.ttf +0 -0
- package/docs/static/bower_components/fontawesome/webfonts/fa-regular-400.woff2 +0 -0
- package/docs/static/bower_components/fontawesome/webfonts/fa-solid-900.ttf +0 -0
- package/docs/static/bower_components/fontawesome/webfonts/fa-solid-900.woff2 +0 -0
- package/docs/static/bower_components/fontawesome/webfonts/fa-v4compatibility.ttf +0 -0
- package/docs/static/bower_components/fontawesome/webfonts/fa-v4compatibility.woff2 +0 -0
- package/docs/static/bower_components/jquery/dist/jquery.js +0 -10704
- package/docs/static/bower_components/jquery/dist/jquery.min.js +0 -2
- package/docs/static/bower_components/jquery-mockjax/dist/jquery.mockjax.js +0 -1061
- package/docs/static/documentation.js +0 -26
- package/docs/static/example.postcss +0 -68
- package/docs/static/example_data.js +0 -122
- package/docs/static/examples/autoescape.js +0 -17
- package/docs/static/examples/autoscroll.js +0 -6
- package/docs/static/examples/button-on-right.js +0 -13
- package/docs/static/examples/custom_html.js +0 -27
- package/docs/static/examples/drag-outside.js +0 -37
- package/docs/static/examples/drag_and_drop.js +0 -13
- package/docs/static/examples/filter.js +0 -63
- package/docs/static/examples/icon_buttons.js +0 -12
- package/docs/static/examples/load_json_data.js +0 -16
- package/docs/static/examples/load_json_data_from_server.js +0 -9
- package/docs/static/examples/load_on_demand.js +0 -19
- package/docs/static/examples/multiple_select.js +0 -23
- package/docs/static/examples/right-to-left.js +0 -11
- package/docs/static/examples/save_state.js +0 -11
- package/docs/static/monokai.css +0 -70
- package/docs/static/spinner.gif +0 -0
- package/docs/tailwind.config.js +0 -16
- package/sitemap.txt +0 -14
- package/src/playwright/.eslintrc +0 -5
- package/src/playwright/coverage.ts +0 -38
- package/src/playwright/playwright.test.ts +0 -401
- package/src/playwright/playwright.test.ts-snapshots/with-dragAndDrop-moves-a-node-1-Chromium-darwin.png +0 -0
- package/src/playwright/playwright.test.ts-snapshots/with-dragAndDrop-moves-a-node-1-Chromium-linux.png +0 -0
- package/src/playwright/playwright.test.ts-snapshots/without-dragAndDrop-displays-a-tree-1-Chromium-darwin.png +0 -0
- package/src/playwright/playwright.test.ts-snapshots/without-dragAndDrop-displays-a-tree-1-Chromium-linux.png +0 -0
- package/src/playwright/playwright.test.ts-snapshots/without-dragAndDrop-selects-a-node-1-Chromium-darwin.png +0 -0
- package/src/playwright/playwright.test.ts-snapshots/without-dragAndDrop-selects-a-node-1-Chromium-linux.png +0 -0
- package/src/playwright/testUtils.ts +0 -153
- package/src/test/.eslintrc +0 -17
- package/src/test/global.d.ts +0 -1
- package/src/test/jqTree/accessibility.test.ts +0 -25
- package/src/test/jqTree/create.test.ts +0 -54
- package/src/test/jqTree/events.test.ts +0 -290
- package/src/test/jqTree/keyboard.test.ts +0 -247
- package/src/test/jqTree/loadOnDemand.test.ts +0 -198
- package/src/test/jqTree/methods.test.ts +0 -1491
- package/src/test/jqTree/mouse.test.ts +0 -82
- package/src/test/jqTree/options.test.ts +0 -595
- package/src/test/node.test.ts +0 -1396
- package/src/test/nodeUtils.test.ts +0 -21
- package/src/test/position.test.ts +0 -30
- package/src/test/support/exampleData.ts +0 -23
- package/src/test/support/jqTreeMatchers.ts +0 -68
- package/src/test/support/matchers.d.ts +0 -31
- package/src/test/support/setupTests.ts +0 -5
- package/src/test/support/testUtil.ts +0 -30
- package/src/test/support/treeStructure.ts +0 -39
- package/src/test/util.test.ts +0 -27
- package/tsconfig.json +0 -24
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: getData
|
|
3
|
-
name: node-functions-getdata
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
**function getData(includeParent = false);**
|
|
7
|
-
|
|
8
|
-
Get the subtree of this node.
|
|
9
|
-
|
|
10
|
-
**includeParent**
|
|
11
|
-
|
|
12
|
-
* **true**: include node and children
|
|
13
|
-
* **false**: only include children (default)
|
|
14
|
-
|
|
15
|
-
{% highlight js %}
|
|
16
|
-
var data = node.getData();
|
|
17
|
-
{% endhighlight %}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: getLevel
|
|
3
|
-
name: node-functions-getlevel
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
Get the level of a node. The level is distance of a node to the root node.
|
|
7
|
-
|
|
8
|
-
{% highlight js %}
|
|
9
|
-
var node = $('#tree1').tree('getNodeById', 123);
|
|
10
|
-
|
|
11
|
-
// result is e.g. 2
|
|
12
|
-
var level = node.getLevel();
|
|
13
|
-
{% endhighlight %}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: getNextNode
|
|
3
|
-
name: node-functions-getnextnode
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
Get the next node in the tree. This is the next sibling, if there is one. Or, if there is no next sibling, a node further down in the tree.
|
|
7
|
-
|
|
8
|
-
- Returns a node or null.
|
|
9
|
-
|
|
10
|
-
{% highlight js %}
|
|
11
|
-
const nextNode = node.getNextNode();
|
|
12
|
-
{% endhighlight %}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: getNextVisibleNode
|
|
3
|
-
name: node-functions-getnextvisiblenode
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
Get the next visible node in the tree. Does the same as using the _down_ key.
|
|
7
|
-
|
|
8
|
-
This is the previous sibling, if there is one. Or, if there is no previous sibling, a node further up in the tree that is visible.
|
|
9
|
-
|
|
10
|
-
- Returns a node or null.
|
|
11
|
-
- A node is visible if all its parents are open.
|
|
12
|
-
|
|
13
|
-
{% highlight js %}
|
|
14
|
-
const nextNode = node.getNextVisibleNode();
|
|
15
|
-
{% endhighlight %}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: getPreviousNode
|
|
3
|
-
name: node-functions-getpreviousnode
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
Return the previous node in the tree. This is the previous sibling, if there is one. Or, if there is no previous sibling, a node further up in the tree.
|
|
7
|
-
|
|
8
|
-
- Returns a node or null.
|
|
9
|
-
|
|
10
|
-
{% highlight js %}
|
|
11
|
-
const previousNode = node.getPreviousNode();
|
|
12
|
-
{% endhighlight %}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: getPreviousVisibleNode
|
|
3
|
-
name: node-functions-getpreviousvisiblenode
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
Get the previous visible node in the tree. Does the same as using the _up_ key.
|
|
7
|
-
|
|
8
|
-
This is the previous sibling, if there is one. Or, if there is no previous sibling, a node further up in the tree that is visible.
|
|
9
|
-
|
|
10
|
-
- Returns a node or null.
|
|
11
|
-
- A node is visible if all its parents are open.
|
|
12
|
-
|
|
13
|
-
{% highlight js %}
|
|
14
|
-
const previousNode = node.getPreviousVisibleNode();
|
|
15
|
-
{% endhighlight %}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: Node functions
|
|
3
|
-
name: node-functions
|
|
4
|
-
section: true
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
You can access a node using for example [getNodeById](#functions-getnodebyid) function:
|
|
8
|
-
|
|
9
|
-
{% highlight js %}
|
|
10
|
-
var node = $('#tree1').tree('getNodeById', 123);
|
|
11
|
-
{% endhighlight %}
|
|
12
|
-
|
|
13
|
-
The Node object has the following properties and functions:
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: autoOpen
|
|
3
|
-
name: options-autoopen
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
Open nodes initially.
|
|
7
|
-
|
|
8
|
-
* **true**: open all nodes.
|
|
9
|
-
* **false (default)**: do nothing
|
|
10
|
-
* **n**: open n levels
|
|
11
|
-
|
|
12
|
-
Open all nodes initially:
|
|
13
|
-
|
|
14
|
-
{% highlight js %}
|
|
15
|
-
$('#tree1').tree({
|
|
16
|
-
data: data,
|
|
17
|
-
autoOpen: true
|
|
18
|
-
});
|
|
19
|
-
{% endhighlight %}
|
|
20
|
-
|
|
21
|
-
Open first level nodes:
|
|
22
|
-
|
|
23
|
-
{% highlight js %}
|
|
24
|
-
$('#tree1').tree({
|
|
25
|
-
data: data,
|
|
26
|
-
autoOpen: 0
|
|
27
|
-
});
|
|
28
|
-
{% endhighlight %}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: buttonLeft
|
|
3
|
-
name: options-buttonleft
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
Set the position of the toggle button; can be `true` (left) or `false` (right). The default is `true`.
|
|
7
|
-
|
|
8
|
-
{% highlight js %}
|
|
9
|
-
$('#tree1').tree({
|
|
10
|
-
buttonLeft: false
|
|
11
|
-
});
|
|
12
|
-
{% endhighlight %}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: closedIcon
|
|
3
|
-
name: options-closedicon
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
A character or symbol to display on closed nodes. The default is '►' (►)
|
|
7
|
-
|
|
8
|
-
The value can be a:
|
|
9
|
-
|
|
10
|
-
- **string**. E.g. a unicode character or a text.
|
|
11
|
-
- The text is escaped.
|
|
12
|
-
- **html element**. E.g. for an icon
|
|
13
|
-
- **JQuery element**. Also for an icon
|
|
14
|
-
|
|
15
|
-
{% highlight js %}
|
|
16
|
-
// String
|
|
17
|
-
$('#tree1').tree({ closedIcon: '+' });
|
|
18
|
-
|
|
19
|
-
// Html element
|
|
20
|
-
const icon = document.createElement("span");
|
|
21
|
-
icon.className = "icon test";
|
|
22
|
-
$('#tree1').tree({ closedIcon: icon });
|
|
23
|
-
|
|
24
|
-
// JQuery element
|
|
25
|
-
$('#tree1').tree({ closedIcon: $('<span class="icon test" />') });
|
|
26
|
-
{% endhighlight %}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: dataUrl
|
|
3
|
-
name: options-data-url
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
Load the node data from this url.
|
|
7
|
-
|
|
8
|
-
{% highlight js %}
|
|
9
|
-
$('#tree1').tree({
|
|
10
|
-
dataUrl: '/example_data.json'
|
|
11
|
-
});
|
|
12
|
-
{% endhighlight %}
|
|
13
|
-
|
|
14
|
-
You can also set the **data-url** attribute on the dom element:
|
|
15
|
-
|
|
16
|
-
{% highlight html %}
|
|
17
|
-
<div id="tree1" data-url="/example_data.json"></div>
|
|
18
|
-
<script>
|
|
19
|
-
$('#tree1').tree();
|
|
20
|
-
</script>
|
|
21
|
-
{% endhighlight %}
|
|
22
|
-
|
|
23
|
-
You can set additional [jquery ajax options](http://api.jquery.com/jQuery.ajax/) in an object:
|
|
24
|
-
|
|
25
|
-
{% highlight js %}
|
|
26
|
-
$('#tree1').tree({
|
|
27
|
-
dataUrl: {
|
|
28
|
-
url: '/example_data.json',
|
|
29
|
-
headers: {'abc': 'def'}
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
{% endhighlight %}
|
|
33
|
-
|
|
34
|
-
Or you can use a function:
|
|
35
|
-
|
|
36
|
-
{% highlight js %}
|
|
37
|
-
$('#tree1').tree({
|
|
38
|
-
dataUrl: function(node) {
|
|
39
|
-
return {
|
|
40
|
-
url: '/example_data.json',
|
|
41
|
-
headers: {'abc': 'def'}
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
});
|
|
45
|
-
{% endhighlight %}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: data
|
|
3
|
-
name: options-data
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
Define the contents of the tree. The data is a nested array of objects. This option is required.
|
|
7
|
-
|
|
8
|
-
It looks like this:
|
|
9
|
-
|
|
10
|
-
{% highlight js %}
|
|
11
|
-
var data = [
|
|
12
|
-
{
|
|
13
|
-
name: 'node1',
|
|
14
|
-
children: [
|
|
15
|
-
{ name: 'child1' },
|
|
16
|
-
{ name: 'child2' }
|
|
17
|
-
]
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
name: 'node2',
|
|
21
|
-
children: [
|
|
22
|
-
{ name: 'child3' }
|
|
23
|
-
]
|
|
24
|
-
}
|
|
25
|
-
];
|
|
26
|
-
$('#tree1').tree({data: data});
|
|
27
|
-
{% endhighlight %}
|
|
28
|
-
|
|
29
|
-
* **name**: name of a node (required)
|
|
30
|
-
* Note that you can also use `label` instead of `name`
|
|
31
|
-
* **children**: array of child nodes (optional)
|
|
32
|
-
* **id**: int or string (optional)
|
|
33
|
-
* Must be an int or a string
|
|
34
|
-
* Must be unique in the tree
|
|
35
|
-
* The `id` property is required if you use the multiple selection feature
|
|
36
|
-
|
|
37
|
-
You can also include other data in the objects. You can later access this data.
|
|
38
|
-
|
|
39
|
-
For example, to add an id:
|
|
40
|
-
|
|
41
|
-
{% highlight js %}
|
|
42
|
-
{
|
|
43
|
-
name: 'node1',
|
|
44
|
-
id: 1
|
|
45
|
-
}
|
|
46
|
-
{% endhighlight %}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: dataFilter
|
|
3
|
-
name: options-datafilter
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
Process the tree data from the server.
|
|
7
|
-
|
|
8
|
-
{% highlight js %}
|
|
9
|
-
$('#tree1').tree({
|
|
10
|
-
dataUrl: '/my/data/',
|
|
11
|
-
dataFilter: function(data) {
|
|
12
|
-
// Example:
|
|
13
|
-
// the server puts the tree data in 'my_tree_data'
|
|
14
|
-
return data['my_tree_data'];
|
|
15
|
-
}
|
|
16
|
-
});
|
|
17
|
-
{% endhighlight %}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: dragAndDrop
|
|
3
|
-
name: options-draganddrop
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
Turn on dragging and dropping of nodes.
|
|
7
|
-
|
|
8
|
-
* **true**: turn on drag and drop
|
|
9
|
-
* **false (default)**: do not allow drag and drop
|
|
10
|
-
|
|
11
|
-
Example: turn on drag and drop.
|
|
12
|
-
|
|
13
|
-
{% highlight js %}
|
|
14
|
-
$('#tree1').tree({
|
|
15
|
-
data: data,
|
|
16
|
-
dragAndDrop: true
|
|
17
|
-
});
|
|
18
|
-
{% endhighlight %}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: keyboardSupport
|
|
3
|
-
name: options-keyboardsupport
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
Enable or disable keyboard support. Default is enabled.
|
|
7
|
-
|
|
8
|
-
Example: disable keyboard support.
|
|
9
|
-
|
|
10
|
-
{% highlight js %}
|
|
11
|
-
$('#tree1').tree({
|
|
12
|
-
keyboardSupport: false
|
|
13
|
-
});
|
|
14
|
-
{% endhighlight %}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: onCanMove
|
|
3
|
-
name: options-oncanmove
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
You can override this function to determine if a node can be moved.
|
|
7
|
-
|
|
8
|
-
{% highlight js %}
|
|
9
|
-
$('#tree1').tree({
|
|
10
|
-
data: data,
|
|
11
|
-
dragAndDrop: true,
|
|
12
|
-
onCanMove: function(node) {
|
|
13
|
-
if (! node.parent.parent) {
|
|
14
|
-
// Example: Cannot move root node
|
|
15
|
-
return false;
|
|
16
|
-
}
|
|
17
|
-
else {
|
|
18
|
-
return true;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
{% endhighlight %}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: onCanMoveTo
|
|
3
|
-
name: options-oncanmoveto
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
You can override this function to determine if a node can be moved to a certain position.
|
|
7
|
-
|
|
8
|
-
{% highlight js %}
|
|
9
|
-
$('#tree1').tree({
|
|
10
|
-
data: data,
|
|
11
|
-
dragAndDrop: true,
|
|
12
|
-
onCanMoveTo: function(movedNode, targetNode, position) {
|
|
13
|
-
if (targetNode.isMenu) {
|
|
14
|
-
// Example: can move inside menu, not before or after
|
|
15
|
-
return (position == 'inside');
|
|
16
|
-
}
|
|
17
|
-
else {
|
|
18
|
-
return true;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
{% endhighlight %}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: onCanSelectNode
|
|
3
|
-
name: options-oncanselectnode
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
You can set a function to override if a node can be selected. The function gets a node as parameter, and must return true or false.
|
|
7
|
-
|
|
8
|
-
For this to work, the option 'selectable' must be 'true'.
|
|
9
|
-
|
|
10
|
-
{% highlight js %}
|
|
11
|
-
// Example: nodes with children cannot be selected
|
|
12
|
-
$('#tree1').tree({
|
|
13
|
-
data: data,
|
|
14
|
-
selectable: true
|
|
15
|
-
onCanSelectNode: function(node) {
|
|
16
|
-
if (node.children.length == 0) {
|
|
17
|
-
// Nodes without children can be selected
|
|
18
|
-
return true;
|
|
19
|
-
}
|
|
20
|
-
else {
|
|
21
|
-
// Nodes with children cannot be selected
|
|
22
|
-
return false;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
{% endhighlight %}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: onCreateLi
|
|
3
|
-
name: options-oncreateli
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
The function is called for each created node. You can use this to define extra html.
|
|
7
|
-
|
|
8
|
-
The function is called with the following parameters:
|
|
9
|
-
|
|
10
|
-
* **node**: Node element
|
|
11
|
-
* **$li**: Jquery li element
|
|
12
|
-
* **isSelected**: is the node selected (true/false)
|
|
13
|
-
|
|
14
|
-
{% highlight js %}
|
|
15
|
-
$('#tree1').tree({
|
|
16
|
-
data: data,
|
|
17
|
-
onCreateLi: function(node, $li, isSelected) {
|
|
18
|
-
// Add 'icon' span before title
|
|
19
|
-
$li.find('.jqtree-title').before('<span class="icon"></span>');
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
{% endhighlight %}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: onDragMove
|
|
3
|
-
name: options-ondragmove
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
Function that is called when a node is dragged **outside** the tree. This function is called while the node is being dragged.
|
|
7
|
-
|
|
8
|
-
* Also see the ``onDragStop`` option.
|
|
9
|
-
* The function signature is function(node, event);
|
|
10
|
-
|
|
11
|
-
{% highlight js %}
|
|
12
|
-
function handleMove(node: Node, e: JQueryEventObject) {
|
|
13
|
-
//
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
$tree.tree({
|
|
17
|
-
dragAndDrop: true,
|
|
18
|
-
onDragMove: handleMove,
|
|
19
|
-
});
|
|
20
|
-
{% endhighlight %}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: onDragStop
|
|
3
|
-
name: options-ondragstop
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
Function that is called when a node is dragged **outside** the tree. This function is called when user stops dragging.
|
|
7
|
-
|
|
8
|
-
* Also see the ``onDragMove`` option.
|
|
9
|
-
* The function signature is function(node, event);
|
|
10
|
-
|
|
11
|
-
{% highlight js %}
|
|
12
|
-
function handleStop(node: Node, e: JQueryEventObject) {
|
|
13
|
-
//
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
$tree.tree({
|
|
17
|
-
dragAndDrop: true,
|
|
18
|
-
onDragStop: handleMove,
|
|
19
|
-
});
|
|
20
|
-
{% endhighlight %}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: onIsMoveHandle
|
|
3
|
-
name: options-onismovehandle
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
You can override this function to determine if a dom element can be used to move a node.
|
|
7
|
-
|
|
8
|
-
{% highlight js %}
|
|
9
|
-
$('#tree1').tree({
|
|
10
|
-
data: data,
|
|
11
|
-
onIsMoveHandle: function($element) {
|
|
12
|
-
// Only dom elements with 'jqtree-title' class can be used
|
|
13
|
-
// as move handle.
|
|
14
|
-
return ($element.is('.jqtree-title'));
|
|
15
|
-
}
|
|
16
|
-
});
|
|
17
|
-
{% endhighlight %}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: onLoadFailed
|
|
3
|
-
name: options-onloadfailed
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
When loading the data by ajax fails, then the option **onLoadFailed** is called.
|
|
7
|
-
|
|
8
|
-
{% highlight js %}
|
|
9
|
-
$('#tree1').tree({
|
|
10
|
-
dataUrl: '/my/data/',
|
|
11
|
-
onLoadFailed: function(response) {
|
|
12
|
-
//
|
|
13
|
-
}
|
|
14
|
-
});
|
|
15
|
-
{% endhighlight %}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: onLoading
|
|
3
|
-
name: options-onloading
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
The onLoading parameter is called when the tree data is loading. This gives us the opportunity to display a loading signal.
|
|
7
|
-
|
|
8
|
-
Callback looks like this:
|
|
9
|
-
|
|
10
|
-
```js
|
|
11
|
-
function (isLoading, node, $el)
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
* **isLoading**: boolean
|
|
15
|
-
* true: data is loading
|
|
16
|
-
* false: data is loaded
|
|
17
|
-
* **node**:
|
|
18
|
-
* Node: if a node is loading
|
|
19
|
-
* null: if the tree is loading
|
|
20
|
-
* **$el**:
|
|
21
|
-
* if a node is loading this is the `li` element
|
|
22
|
-
* if the tree is loading is the `ul` element of the whole tree
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: openedIcon
|
|
3
|
-
name: options-openedicon
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
A character or symbol to display on opened nodes. The default is '&#x25bc;' (▼)
|
|
7
|
-
|
|
8
|
-
The value can be a:
|
|
9
|
-
|
|
10
|
-
- **string**. E.g. a unicode character or a text.
|
|
11
|
-
- The text is escaped.
|
|
12
|
-
- **html element**. E.g. for an icon
|
|
13
|
-
- **JQuery element**. Also for an icon
|
|
14
|
-
|
|
15
|
-
{% highlight js %}
|
|
16
|
-
// String
|
|
17
|
-
$('#tree1').tree({ openedIcon: '-' });
|
|
18
|
-
|
|
19
|
-
// Html element
|
|
20
|
-
const icon = document.createElement("span");
|
|
21
|
-
icon.className = "icon test";
|
|
22
|
-
$('#tree1').tree({ openedIcon: icon });
|
|
23
|
-
|
|
24
|
-
// JQuery element
|
|
25
|
-
$('#tree1').tree({ openedIcon: $('<span class="icon test" />') });
|
|
26
|
-
{% endhighlight %}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: openFolderDelay
|
|
3
|
-
name: options-openfolderdelay
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
Set the delay for opening a folder during drag-and-drop. The delay is in milliseconds. The default is 500 ms.
|
|
7
|
-
|
|
8
|
-
* Setting the option to `false` disables opening folders during drag-and-drop.
|
|
9
|
-
|
|
10
|
-
{% highlight js %}
|
|
11
|
-
$('#tree1').tree({
|
|
12
|
-
dataUrl: '/my/data/',
|
|
13
|
-
openFolderDelay: 1000
|
|
14
|
-
});
|
|
15
|
-
{% endhighlight %}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: rtl
|
|
3
|
-
name: options-rtl
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
Set right-to-left support (true / false). Default is false.
|
|
7
|
-
|
|
8
|
-
{% highlight js %}
|
|
9
|
-
$('#tree1').tree({
|
|
10
|
-
rtl: true
|
|
11
|
-
});
|
|
12
|
-
{% endhighlight %}
|
|
13
|
-
|
|
14
|
-
You can also set the option using ``data-rtl``.
|
|
15
|
-
|
|
16
|
-
{% highlight html %}
|
|
17
|
-
<div id="tree1" data-url="/data" data-rtl></div>
|
|
18
|
-
{% endhighlight %}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: saveState
|
|
3
|
-
name: options-savestate
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
Save and restore the state of the tree automatically. The state is saved in localstorage.
|
|
7
|
-
|
|
8
|
-
For this to work, you should give each node in the tree data an id field:
|
|
9
|
-
|
|
10
|
-
{% highlight js %}
|
|
11
|
-
{
|
|
12
|
-
name: 'node1',
|
|
13
|
-
id: 123,
|
|
14
|
-
childen: [
|
|
15
|
-
name: 'child1',
|
|
16
|
-
id: 124
|
|
17
|
-
]
|
|
18
|
-
}
|
|
19
|
-
{% endhighlight %}
|
|
20
|
-
|
|
21
|
-
* **true**: save and restore state in localstorage
|
|
22
|
-
* **false (default)**: do nothing
|
|
23
|
-
* **string**: save state and use this name to store
|
|
24
|
-
|
|
25
|
-
{% highlight js %}
|
|
26
|
-
$('#tree1').tree({
|
|
27
|
-
data: data,
|
|
28
|
-
saveState: true
|
|
29
|
-
});
|
|
30
|
-
{% endhighlight %}
|
|
31
|
-
|
|
32
|
-
Example: save state in key 'tree1':
|
|
33
|
-
|
|
34
|
-
{% highlight js %}
|
|
35
|
-
$('#tree1').tree({
|
|
36
|
-
data: data,
|
|
37
|
-
saveState: 'tree1'
|
|
38
|
-
});
|
|
39
|
-
{% endhighlight %}
|