forked from vakata/jstree
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
27 changed files
with
12,098 additions
and
12,080 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,22 @@ | ||
Copyright (c) 2014 Ivan Bozhanov | ||
|
||
Permission is hereby granted, free of charge, to any person | ||
obtaining a copy of this software and associated documentation | ||
files (the "Software"), to deal in the Software without | ||
restriction, including without limitation the rights to use, | ||
copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the | ||
Software is furnished to do so, subject to the following | ||
conditions: | ||
|
||
The above copyright notice and this permission notice shall be | ||
included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES | ||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT | ||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, | ||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | ||
OTHER DEALINGS IN THE SOFTWARE. | ||
Copyright (c) 2014 Ivan Bozhanov | ||
Permission is hereby granted, free of charge, to any person | ||
obtaining a copy of this software and associated documentation | ||
files (the "Software"), to deal in the Software without | ||
restriction, including without limitation the rights to use, | ||
copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the | ||
Software is furnished to do so, subject to the following | ||
conditions: | ||
The above copyright notice and this permission notice shall be | ||
included in all copies or substantial portions of the Software. | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES | ||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT | ||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, | ||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | ||
OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,146 +1,146 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>jstree basic demos</title> | ||
<style> | ||
html { margin:0; padding:0; font-size:62.5%; } | ||
body { max-width:800px; min-width:300px; margin:0 auto; padding:20px 10px; font-size:14px; font-size:1.4em; } | ||
h1 { font-size:1.8em; } | ||
.demo { overflow:auto; border:1px solid silver; min-height:100px; } | ||
</style> | ||
<link rel="stylesheet" href="./../../dist/themes/default/style.min.css" /> | ||
</head> | ||
<body> | ||
<h1>HTML demo</h1> | ||
<div id="html" class="demo"> | ||
<ul> | ||
<li data-jstree='{ "opened" : true }'>Root node | ||
<ul> | ||
<li data-jstree='{ "selected" : true }'>Child node 1</li> | ||
<li>Child node 2</li> | ||
</ul> | ||
</li> | ||
</ul> | ||
</div> | ||
|
||
<h1>Inline data demo</h1> | ||
<div id="data" class="demo"></div> | ||
|
||
<h1>Data format demo</h1> | ||
<div id="frmt" class="demo"></div> | ||
|
||
<h1>AJAX demo</h1> | ||
<div id="ajax" class="demo"></div> | ||
|
||
<h1>Lazy loading demo</h1> | ||
<div id="lazy" class="demo"></div> | ||
|
||
<h1>Callback function data demo</h1> | ||
<div id="clbk" class="demo"></div> | ||
|
||
<h1>Interaction and events demo</h1> | ||
<button id="evts_button">select node with id 1</button> <em>either click the button or a node in the tree</em> | ||
<div id="evts" class="demo"></div> | ||
|
||
<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script> | ||
<script src="./../../dist/jstree.min.js"></script> | ||
|
||
<script> | ||
// html demo | ||
$('#html').jstree(); | ||
|
||
// inline data demo | ||
$('#data').jstree({ | ||
'core' : { | ||
'data' : [ | ||
{ "text" : "Root node", "children" : [ | ||
{ "text" : "Child node 1" }, | ||
{ "text" : "Child node 2" } | ||
]} | ||
] | ||
} | ||
}); | ||
|
||
// data format demo | ||
$('#frmt').jstree({ | ||
'core' : { | ||
'data' : [ | ||
{ | ||
"text" : "Root node", | ||
"state" : { "opened" : true }, | ||
"children" : [ | ||
{ | ||
"text" : "Child node 1", | ||
"state" : { "selected" : true }, | ||
"icon" : "jstree-file" | ||
}, | ||
{ "text" : "Child node 2", "state" : { "disabled" : true } } | ||
] | ||
} | ||
] | ||
} | ||
}); | ||
|
||
// ajax demo | ||
$('#ajax').jstree({ | ||
'core' : { | ||
'data' : { | ||
"url" : "./root.json", | ||
"dataType" : "json" // needed only if you do not supply JSON headers | ||
} | ||
} | ||
}); | ||
|
||
// lazy demo | ||
$('#lazy').jstree({ | ||
'core' : { | ||
'data' : { | ||
"url" : "//www.jstree.com/fiddle/?lazy", | ||
"data" : function (node) { | ||
return { "id" : node.id }; | ||
} | ||
} | ||
} | ||
}); | ||
|
||
// data from callback | ||
$('#clbk').jstree({ | ||
'core' : { | ||
'data' : function (node, cb) { | ||
if(node.id === "#") { | ||
cb([{"text" : "Root", "id" : "1", "children" : true}]); | ||
} | ||
else { | ||
cb(["Child"]); | ||
} | ||
} | ||
} | ||
}); | ||
|
||
// interaction and events | ||
$('#evts_button').on("click", function () { | ||
var instance = $('#evts').jstree(true); | ||
instance.deselect_all(); | ||
instance.select_node('1'); | ||
}); | ||
$('#evts') | ||
.on("changed.jstree", function (e, data) { | ||
if(data.selected.length) { | ||
alert('The selected node is: ' + data.instance.get_node(data.selected[0]).text); | ||
} | ||
}) | ||
.jstree({ | ||
'core' : { | ||
'multiple' : false, | ||
'data' : [ | ||
{ "text" : "Root node", "children" : [ | ||
{ "text" : "Child node 1", "id" : 1 }, | ||
{ "text" : "Child node 2" } | ||
]} | ||
] | ||
} | ||
}); | ||
</script> | ||
</body> | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>jstree basic demos</title> | ||
<style> | ||
html { margin:0; padding:0; font-size:62.5%; } | ||
body { max-width:800px; min-width:300px; margin:0 auto; padding:20px 10px; font-size:14px; font-size:1.4em; } | ||
h1 { font-size:1.8em; } | ||
.demo { overflow:auto; border:1px solid silver; min-height:100px; } | ||
</style> | ||
<link rel="stylesheet" href="./../../dist/themes/default/style.min.css" /> | ||
</head> | ||
<body> | ||
<h1>HTML demo</h1> | ||
<div id="html" class="demo"> | ||
<ul> | ||
<li data-jstree='{ "opened" : true }'>Root node | ||
<ul> | ||
<li data-jstree='{ "selected" : true }'>Child node 1</li> | ||
<li>Child node 2</li> | ||
</ul> | ||
</li> | ||
</ul> | ||
</div> | ||
|
||
<h1>Inline data demo</h1> | ||
<div id="data" class="demo"></div> | ||
|
||
<h1>Data format demo</h1> | ||
<div id="frmt" class="demo"></div> | ||
|
||
<h1>AJAX demo</h1> | ||
<div id="ajax" class="demo"></div> | ||
|
||
<h1>Lazy loading demo</h1> | ||
<div id="lazy" class="demo"></div> | ||
|
||
<h1>Callback function data demo</h1> | ||
<div id="clbk" class="demo"></div> | ||
|
||
<h1>Interaction and events demo</h1> | ||
<button id="evts_button">select node with id 1</button> <em>either click the button or a node in the tree</em> | ||
<div id="evts" class="demo"></div> | ||
|
||
<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script> | ||
<script src="./../../dist/jstree.min.js"></script> | ||
|
||
<script> | ||
// html demo | ||
$('#html').jstree(); | ||
|
||
// inline data demo | ||
$('#data').jstree({ | ||
'core' : { | ||
'data' : [ | ||
{ "text" : "Root node", "children" : [ | ||
{ "text" : "Child node 1" }, | ||
{ "text" : "Child node 2" } | ||
]} | ||
] | ||
} | ||
}); | ||
|
||
// data format demo | ||
$('#frmt').jstree({ | ||
'core' : { | ||
'data' : [ | ||
{ | ||
"text" : "Root node", | ||
"state" : { "opened" : true }, | ||
"children" : [ | ||
{ | ||
"text" : "Child node 1", | ||
"state" : { "selected" : true }, | ||
"icon" : "jstree-file" | ||
}, | ||
{ "text" : "Child node 2", "state" : { "disabled" : true } } | ||
] | ||
} | ||
] | ||
} | ||
}); | ||
|
||
// ajax demo | ||
$('#ajax').jstree({ | ||
'core' : { | ||
'data' : { | ||
"url" : "./root.json", | ||
"dataType" : "json" // needed only if you do not supply JSON headers | ||
} | ||
} | ||
}); | ||
|
||
// lazy demo | ||
$('#lazy').jstree({ | ||
'core' : { | ||
'data' : { | ||
"url" : "//www.jstree.com/fiddle/?lazy", | ||
"data" : function (node) { | ||
return { "id" : node.id }; | ||
} | ||
} | ||
} | ||
}); | ||
|
||
// data from callback | ||
$('#clbk').jstree({ | ||
'core' : { | ||
'data' : function (node, cb) { | ||
if(node.id === "#") { | ||
cb([{"text" : "Root", "id" : "1", "children" : true}]); | ||
} | ||
else { | ||
cb(["Child"]); | ||
} | ||
} | ||
} | ||
}); | ||
|
||
// interaction and events | ||
$('#evts_button').on("click", function () { | ||
var instance = $('#evts').jstree(true); | ||
instance.deselect_all(); | ||
instance.select_node('1'); | ||
}); | ||
$('#evts') | ||
.on("changed.jstree", function (e, data) { | ||
if(data.selected.length) { | ||
alert('The selected node is: ' + data.instance.get_node(data.selected[0]).text); | ||
} | ||
}) | ||
.jstree({ | ||
'core' : { | ||
'multiple' : false, | ||
'data' : [ | ||
{ "text" : "Root node", "children" : [ | ||
{ "text" : "Child node 1", "id" : 1 }, | ||
{ "text" : "Child node 2" } | ||
]} | ||
] | ||
} | ||
}); | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
[ | ||
{ "id" : "demo_root_1", "text" : "Root 1", "children" : true, "type" : "root" }, | ||
{ "id" : "demo_root_2", "text" : "Root 2", "type" : "root" } | ||
[ | ||
{ "id" : "demo_root_1", "text" : "Root 1", "children" : true, "type" : "root" }, | ||
{ "id" : "demo_root_2", "text" : "Root 2", "type" : "root" } | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
<ul> | ||
<li>Node 1</li> | ||
<li class="jstree-closed">Node 2</li> | ||
<ul> | ||
<li>Node 1</li> | ||
<li class="jstree-closed">Node 2</li> | ||
</ul> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
[ | ||
{ "text" : "Root 1", "children" : true }, | ||
{ "text" : "Root 2", "children" : true } | ||
[ | ||
{ "text" : "Root 1", "children" : true }, | ||
{ "text" : "Root 2", "children" : true } | ||
] |
Oops, something went wrong.