Skip to content

Commit 92df4d0

Browse files
committed
Fix missing loading icon in non-bootstrap themes
Close #575
1 parent e12cd41 commit 92df4d0

File tree

3 files changed

+26
-20
lines changed

3 files changed

+26
-20
lines changed

CHANGELOG.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1-
# 2.15.1-0 / Unreleased
2-
*
1+
# 2.16.2-0 / Unreleased
2+
*
3+
4+
# 2.16.1 / 2016-03-18
5+
* [Fixed] #575 missing loading icon in non-bootstrap themes
36

47
# 2.16.0 / 2016-03-16
58
* [Added] ext-clones: new method node.setRefKey(refKey)

src/jquery.fancytree.glyph.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ $.ui.fancytree.registerExtension({
4343
expanderClosed: "icon-caret-right",
4444
expanderLazy: "icon-angle-right",
4545
expanderOpen: "icon-caret-down",
46+
nodata: "icon-meh",
4647
noExpander: "",
4748
dragHelper: "icon-caret-right",
4849
dropMarker: "icon-caret-right",
@@ -78,9 +79,7 @@ $.ui.fancytree.registerExtension({
7879
if( span ){
7980
// if( node.isLoading() ){
8081
// icon = "loading";
81-
if( node.statusNodeType ){
82-
icon = node.statusNodeType; // loading, error
83-
}else if( node.expanded ){
82+
if( node.expanded ){
8483
icon = "expanderOpen";
8584
}else if( node.isUndefined() ){
8685
icon = "expanderLazy";
@@ -106,7 +105,9 @@ $.ui.fancytree.registerExtension({
106105
// that might be set by opts.icon callbacks)
107106
span = $span.children("span.fancytree-icon").get(0);
108107
if( span ){
109-
if( node.folder ){
108+
if( node.statusNodeType ){
109+
icon = _getIcon(opts, node.statusNodeType); // loading, error
110+
}else if( node.folder ){
110111
icon = node.expanded ? _getIcon(opts, "folderOpen") : _getIcon(opts, "folder");
111112
}else{
112113
icon = node.expanded ? _getIcon(opts, "docOpen") : _getIcon(opts, "doc");
@@ -122,16 +123,15 @@ $.ui.fancytree.registerExtension({
122123

123124
res = this._superApply(arguments);
124125

125-
if(node.parent){
126-
span = $("span.fancytree-expander", node.span).get(0);
127-
}else{
128-
span = $(".fancytree-statusnode-loading, .fancytree-statusnode-error", node[this.nodeContainerAttrName])
129-
.find("span.fancytree-expander").get(0);
130-
}
131-
if( status === "loading" ){
132-
span.className = "fancytree-expander " + _getIcon(opts, "loading");
133-
}else if( status === "error" ){
134-
span.className = "fancytree-expander " + _getIcon(opts, "error");
126+
if( status === "error" || status === "loading" || status === "nodata" ){
127+
if(node.parent){
128+
span = $("span.fancytree-expander", node.span).get(0);
129+
span.className = "fancytree-expander " + _getIcon(opts, status);
130+
}else{ //
131+
span = $(".fancytree-statusnode-" + status, node[this.nodeContainerAttrName])
132+
.find("span.fancytree-icon").get(0);
133+
span.className = "fancytree-icon " + _getIcon(opts, status);
134+
}
135135
}
136136
return res;
137137
}

src/jquery.fancytree.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2812,7 +2812,7 @@ $.extend(Fancytree.prototype,
28122812
if($.isArray(delay)){ // random delay range [min..max]
28132813
delay = delay[0] + Math.random() * (delay[1] - delay[0]);
28142814
}
2815-
node.debug("nodeLoadChildren waiting debug delay " + Math.round(delay) + "ms");
2815+
node.warn("nodeLoadChildren waiting debugDelay " + Math.round(delay) + " ms ...");
28162816
ajax.debugDelay = false;
28172817
dfd = $.Deferred(function (dfd) {
28182818
setTimeout(function () {
@@ -3857,7 +3857,8 @@ $.extend(Fancytree.prototype,
38573857
if( !node.parent ) {
38583858
_setStatusNode({
38593859
title: tree.options.strings.loading + (message ? " (" + message + ")" : ""),
3860-
icon: false,
3860+
// icon: true, // needed for 'loding' icon
3861+
checkbox: false,
38613862
tooltip: details
38623863
}, status);
38633864
}
@@ -3868,7 +3869,8 @@ $.extend(Fancytree.prototype,
38683869
case "error":
38693870
_setStatusNode({
38703871
title: tree.options.strings.loadError + (message ? " (" + message + ")" : ""),
3871-
icon: false,
3872+
// icon: false,
3873+
checkbox: false,
38723874
tooltip: details
38733875
}, status);
38743876
node._isLoading = false;
@@ -3878,7 +3880,8 @@ $.extend(Fancytree.prototype,
38783880
case "nodata":
38793881
_setStatusNode({
38803882
title: tree.options.strings.noData,
3881-
icon: false,
3883+
// icon: false,
3884+
checkbox: false,
38823885
tooltip: details
38833886
}, status);
38843887
node._isLoading = false;

0 commit comments

Comments
 (0)