Skip to content

Commit

Permalink
a few minor bugs fixed
Browse files Browse the repository at this point in the history
added more docs
  • Loading branch information
vakata committed Dec 30, 2013
1 parent 8554ee1 commit 691bfa9
Show file tree
Hide file tree
Showing 28 changed files with 7,215 additions and 271 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/demo
/jstree.sublime-project
/jstree.sublime-workspace
/node_modules
/node_modules
/site
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jstree",
"version": "3.0.0",
"version": "3.0.0-beta",
"main" : [
"./dist/jstree.min.js",
"./dist/themes/default/style.min.css"
Expand Down
15 changes: 10 additions & 5 deletions dist/jstree.js
Original file line number Diff line number Diff line change
Expand Up @@ -2477,7 +2477,8 @@
if(!pos.match(/^(before|after)$/) && !is_loaded && !this.is_loaded(par)) {
return this.load_node(par, function () { this.create_node(par, node, pos, callback, true); });
}
if(!node) { node = this.get_string('New node'); }
if(!node) { node = { "text" : this.get_string('New node') }; }
if(node.text === undefined) { node.text = this.get_string('New node'); }
var tmp, dpc, i, j;

if(par.id === '#') {
Expand Down Expand Up @@ -2507,7 +2508,9 @@
break;
}
if(pos > par.children.length) { pos = par.children.length; }
if(!node.id) { node.id = true; }
if(!this.check("create_node", node, par, pos)) { return false; }
delete node.id;
node = this._parse_model_from_json(node, par.id, par.parents.concat());
if(!node) { return false; }
tmp = this.get_node(node);
Expand All @@ -2528,7 +2531,7 @@
tmp[pos] = node.id;
par.children = tmp;

this.redraw_node(par);
this.redraw_node(par, true);
if(callback) { callback.call(this, this.get_node(node)); }
/**
* triggered when a node is created
Expand Down Expand Up @@ -3030,7 +3033,7 @@
if(key === 27) {
this.value = t;
}
if(key === 27 || key === 13 || key === 37 || key === 38 || key === 39 || key === 40) {
if(key === 27 || key === 13 || key === 37 || key === 38 || key === 39 || key === 40 || key === 32) {
event.stopImmediatePropagation();
}
if(key === 27 || key === 13) {
Expand Down Expand Up @@ -3580,13 +3583,15 @@
this._undetermined = function () {
var i, j, m = this._model.data, s = this._data.core.selected, p = [], t = this;
for(i = 0, j = s.length; i < j; i++) {
p = p.concat(m[s[i]].parents);
if(m[s[i]] && m[s[i]].parents) {
p = p.concat(m[s[i]].parents);
}
}
// attempt for server side undetermined state
this.element.find('.jstree-closed').not(':has(ul)')
.each(function () {
var tmp = t.get_node(this);
if(!tmp.state.loaded && tmp.original.state.undetermined === true) {
if(!tmp.state.loaded && tmp.original && tmp.original.state && tmp.original.state.undetermined && tmp.original.state.undetermined === true) {
p.push(tmp.id);
p = p.concat(tmp.parents);
}
Expand Down
8 changes: 4 additions & 4 deletions dist/jstree.min.js

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion docs/ajax_children.json

This file was deleted.

1 change: 1 addition & 0 deletions docs/assets/ajax_children.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
["Child 1", { "text" : "Child 2", "children" : ["One more"] }]
1 change: 1 addition & 0 deletions docs/assets/ajax_demo_children.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
["Child 1", { "id" : "demo_child_1", "text" : "Child 2", "children" : [ { "id" : "demo_child_2", "text" : "One more", "type" : "file" }] }]
4 changes: 4 additions & 0 deletions docs/assets/ajax_demo_roots.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[
{ "id" : "demo_root_1", "text" : "Root 1", "children" : true, "type" : "root" },
{ "id" : "demo_root_2", "text" : "Root 2", "type" : "root" }
]
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 691bfa9

Please sign in to comment.