kosmas58-compass-jquery-plugin 0.1.8.1 → 0.1.8.2
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.
- data/README.textile +1 -1
- data/lib/jquery/version.rb +4 -3
- data/templates/dynatree/jquery.dynatree.js +180 -99
- data/templates/dynatree/jquery.dynatree.min.js +1 -1
- data/templates/dynatree/jquery.ui/dynatree.aqua.sass +21 -0
- data/templates/dynatree/jquery.ui/dynatree.crystal.sass +21 -0
- data/templates/dynatree/jquery.ui/dynatree.vista.sass +21 -0
- data/templates/dynatree/jquery.ui/dynatree.xp.sass +23 -3
- data/templates/dynatree/manifest.rb +25 -0
- data/templates/jrails/manifest.rb +338 -0
- metadata +2 -2
data/README.textile
CHANGED
@@ -8,7 +8,7 @@ A Sass-based Meta-Framework for Compass that allows you to mix and match any of
|
|
8
8
|
|
9
9
|
* jRails with jQuery and jQuery.UI including themes
|
10
10
|
* jqGrid V3.5
|
11
|
-
* dynatree V0.5.
|
11
|
+
* dynatree V0.5.1
|
12
12
|
|
13
13
|
This library requires <b>"Compass":http://wiki.github.com/chriseppstein/compass</b>.
|
14
14
|
|
data/lib/jquery/version.rb
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
module CompassJqueryPlugin#:nodoc:
|
2
2
|
|
3
3
|
class VERSION #:nodoc:
|
4
|
-
|
5
|
-
|
4
|
+
|
5
|
+
PATCH = 2 # Set to nil for official release
|
6
6
|
TINY = 8
|
7
|
-
|
7
|
+
MINOR = 1
|
8
|
+
MAJOR = 0
|
8
9
|
|
9
10
|
STRING = [MAJOR, MINOR, TINY, PATCH].compact.join('.')
|
10
11
|
STABLE_STRING = [MAJOR, MINOR, TINY].join('.')
|
@@ -10,8 +10,8 @@
|
|
10
10
|
|
11
11
|
Let me know, if you find bugs or improvements (martin at domain wwWendt.de).
|
12
12
|
|
13
|
-
$Version: 0.5.
|
14
|
-
$Revision:
|
13
|
+
$Version: 0.5.1$
|
14
|
+
$Revision: 279, 2009-08-16 21:08:44$
|
15
15
|
|
16
16
|
@depends: jquery.js
|
17
17
|
@depends: ui.core.js
|
@@ -109,7 +109,7 @@ DynaTreeNode.prototype = {
|
|
109
109
|
this.div = null; // not yet created
|
110
110
|
this.span = null; // not yet created
|
111
111
|
this.childList = null; // no subnodes yet
|
112
|
-
this.isRead = false; // Lazy content not yet read
|
112
|
+
// this.isRead = false; // Lazy content not yet read
|
113
113
|
this.isLoading = false; // Lazy content is being loaded
|
114
114
|
this.hasSubSel = false;
|
115
115
|
},
|
@@ -184,6 +184,27 @@ DynaTreeNode.prototype = {
|
|
184
184
|
return res;
|
185
185
|
},
|
186
186
|
|
187
|
+
_fixOrder: function() {
|
188
|
+
/**
|
189
|
+
* Make sure, that <div> order matches childList order.
|
190
|
+
*/
|
191
|
+
var cl = this.childList;
|
192
|
+
if( !cl )
|
193
|
+
return;
|
194
|
+
var childDiv = this.div.firstChild.nextSibling;
|
195
|
+
for(var i=0; i<cl.length-1; i++) {
|
196
|
+
var childNode1 = cl[i];
|
197
|
+
var childNode2 = childDiv.firstChild.dtnode;
|
198
|
+
if( childNode1 !== childNode2 ) {
|
199
|
+
//
|
200
|
+
this.tree.logDebug("_fixOrder: mismatch at index " + i + ": " + childNode1 + " != " + childNode2);
|
201
|
+
this.div.insertBefore(childNode1.div, childNode2.div);
|
202
|
+
} else {
|
203
|
+
childDiv = childDiv.nextSibling;
|
204
|
+
}
|
205
|
+
}
|
206
|
+
},
|
207
|
+
|
187
208
|
render: function(bDeep, bHidden) {
|
188
209
|
/**
|
189
210
|
* Create HTML markup for this node.
|
@@ -195,17 +216,21 @@ DynaTreeNode.prototype = {
|
|
195
216
|
* </div>
|
196
217
|
*/
|
197
218
|
// this.tree.logDebug("%o.render()", this);
|
219
|
+
var opts = this.tree.options;
|
220
|
+
var cn = opts.classNames;
|
221
|
+
var isLastSib = this.isLastSibling();
|
198
222
|
// ---
|
199
223
|
if( ! this.div ) {
|
200
224
|
this.span = document.createElement("span");
|
201
225
|
this.span.dtnode = this;
|
202
226
|
if( this.data.key )
|
203
227
|
this.span.id = this.tree.options.idPrefix + this.data.key;
|
204
|
-
|
205
228
|
this.div = document.createElement("div");
|
206
229
|
this.div.appendChild(this.span);
|
207
|
-
|
230
|
+
|
231
|
+
if ( this.parent ) {
|
208
232
|
this.parent.div.appendChild(this.div);
|
233
|
+
}
|
209
234
|
|
210
235
|
if( this.parent==null && !this.tree.options.rootVisible )
|
211
236
|
this.span.style.display = "none";
|
@@ -217,14 +242,13 @@ DynaTreeNode.prototype = {
|
|
217
242
|
this.div.style.display = ( this.parent==null || this.parent.bExpanded ? "" : "none");
|
218
243
|
|
219
244
|
// Set classes for current status
|
220
|
-
var opts = this.tree.options;
|
221
|
-
var cn = opts.classNames;
|
222
|
-
var isLastSib = this.isLastSibling();
|
223
245
|
var cnList = [];
|
224
246
|
cnList.push( ( this.data.isFolder ) ? cn.folder : cn.document );
|
225
247
|
if( this.bExpanded )
|
226
248
|
cnList.push(cn.expanded);
|
227
|
-
if( this.
|
249
|
+
if( this.childList != null )
|
250
|
+
cnList.push(cn.hasChildren);
|
251
|
+
if( this.data.isLazy && this.childList==null )
|
228
252
|
cnList.push(cn.lazy);
|
229
253
|
if( isLastSib )
|
230
254
|
cnList.push(cn.lastsib);
|
@@ -240,7 +264,7 @@ DynaTreeNode.prototype = {
|
|
240
264
|
// so we create combined class names that can be used in the CSS
|
241
265
|
cnList.push(cn.combinedExpanderPrefix
|
242
266
|
+ (this.bExpanded ? "e" : "c")
|
243
|
-
+ (this.data.isLazy &&
|
267
|
+
+ (this.data.isLazy && this.childList==null ? "d" : "")
|
244
268
|
+ (isLastSib ? "l" : "")
|
245
269
|
);
|
246
270
|
cnList.push(cn.combinedIconPrefix
|
@@ -253,6 +277,7 @@ DynaTreeNode.prototype = {
|
|
253
277
|
for(var i=0; i<this.childList.length; i++) {
|
254
278
|
this.childList[i].render(bDeep, bHidden)
|
255
279
|
}
|
280
|
+
this._fixOrder();
|
256
281
|
}
|
257
282
|
},
|
258
283
|
|
@@ -309,7 +334,7 @@ DynaTreeNode.prototype = {
|
|
309
334
|
switch( lts ) {
|
310
335
|
case DTNodeStatus_Ok:
|
311
336
|
this._setStatusNode(null);
|
312
|
-
this.isRead = true;
|
337
|
+
// this.isRead = true;
|
313
338
|
this.isLoading = false;
|
314
339
|
this.render(false, false);
|
315
340
|
if( this.tree.options.autoFocus ) {
|
@@ -377,7 +402,6 @@ DynaTreeNode.prototype = {
|
|
377
402
|
// Event coordinates, relative to outer node span:
|
378
403
|
var eventX = event.pageX - target.offsetLeft;
|
379
404
|
var eventY = event.pageY - target.offsetTop;
|
380
|
-
// alert ("click at " + eventX + ", " + eventY);
|
381
405
|
|
382
406
|
for(var i=0; i<target.childNodes.length; i++) {
|
383
407
|
var cn = target.childNodes[i];
|
@@ -648,6 +672,8 @@ DynaTreeNode.prototype = {
|
|
648
672
|
select: function(sel) {
|
649
673
|
// Select - but not focus - this node.
|
650
674
|
// this.tree.logDebug("dtnode.select(%o) - %o", sel, this);
|
675
|
+
if( this.data.unselectable )
|
676
|
+
return this.bSelected;
|
651
677
|
return this._select(sel!=false, true, true);
|
652
678
|
},
|
653
679
|
|
@@ -660,6 +686,24 @@ DynaTreeNode.prototype = {
|
|
660
686
|
return this.bSelected;
|
661
687
|
},
|
662
688
|
|
689
|
+
_loadContent: function() {
|
690
|
+
try {
|
691
|
+
var opts = this.tree.options;
|
692
|
+
this.tree.logDebug("_loadContent: start - %o", this);
|
693
|
+
this.setLazyNodeStatus(DTNodeStatus_Loading);
|
694
|
+
if( true == opts.onLazyRead.call(this.span, this) ) {
|
695
|
+
// If function returns 'true', we assume that the loading is done:
|
696
|
+
this.setLazyNodeStatus(DTNodeStatus_Ok);
|
697
|
+
// Otherwise (i.e. if the loading was started as an asynchronous process)
|
698
|
+
// the onLazyRead(dtnode) handler is expected to call dtnode.setLazyNodeStatus(DTNodeStatus_Ok/_Error) when done.
|
699
|
+
this.tree.logDebug("_loadContent: succeeded - %o", this);
|
700
|
+
}
|
701
|
+
} catch(e) {
|
702
|
+
alert(e);
|
703
|
+
this.setLazyNodeStatus(DTNodeStatus_Error);
|
704
|
+
}
|
705
|
+
},
|
706
|
+
|
663
707
|
_expand: function(bExpand) {
|
664
708
|
// this.tree.logDebug("dtnode._expand(%o) - %o", bExpand, this);
|
665
709
|
if( this.bExpanded == bExpand ) {
|
@@ -692,41 +736,31 @@ DynaTreeNode.prototype = {
|
|
692
736
|
parents[i].collapseSiblings();
|
693
737
|
}
|
694
738
|
|
695
|
-
// If currently active node is now hidden, deactivate it
|
739
|
+
// If the currently active node is now hidden, deactivate it
|
696
740
|
if( opts.activeVisible && this.tree.activeNode && ! this.tree.activeNode.isVisible() ) {
|
697
741
|
this.tree.activeNode.deactivate();
|
698
742
|
}
|
699
743
|
// Expanding a lazy node: set 'loading...' and call callback
|
700
|
-
if( bExpand && this.data.isLazy &&
|
701
|
-
|
702
|
-
this.tree.logDebug("_expand: start lazy - %o", this);
|
703
|
-
this.setLazyNodeStatus(DTNodeStatus_Loading);
|
704
|
-
if( true == opts.onLazyRead.call(this.span, this) ) {
|
705
|
-
// If function returns 'true', we assume that the loading is done:
|
706
|
-
this.setLazyNodeStatus(DTNodeStatus_Ok);
|
707
|
-
// Otherwise (i.e. if the loading was started as an asynchronous process)
|
708
|
-
// the onLazyRead(dtnode) handler is expected to call dtnode.setLazyNodeStatus(DTNodeStatus_Ok/_Error) when done.
|
709
|
-
this.tree.logDebug("_expand: lazy succeeded - %o", this);
|
710
|
-
}
|
711
|
-
} catch(e) {
|
712
|
-
this.setLazyNodeStatus(DTNodeStatus_Error);
|
713
|
-
}
|
744
|
+
if( bExpand && this.data.isLazy && this.childList==null && !this.isLoading ) {
|
745
|
+
this._loadContent();
|
714
746
|
return;
|
715
747
|
}
|
716
748
|
// this.tree.logDebug("_expand: start div toggle - %o", this);
|
717
749
|
|
718
750
|
var fxDuration = opts.fx ? (opts.fx.duration || 200) : 0;
|
719
|
-
|
720
|
-
var
|
721
|
-
|
722
|
-
|
723
|
-
|
724
|
-
$child.
|
725
|
-
|
726
|
-
|
727
|
-
|
728
|
-
|
729
|
-
|
751
|
+
if( this.childList ) {
|
752
|
+
for(var i=0; i<this.childList.length; i++ ) {
|
753
|
+
var $child = $(this.childList[i].div);
|
754
|
+
if( fxDuration ) {
|
755
|
+
// This is a toggle, so only do it, if not already rendered (in)visible (issue 98)
|
756
|
+
if( bExpand != $child.is(':visible') )
|
757
|
+
$child.animate(opts.fx, fxDuration);
|
758
|
+
} else {
|
759
|
+
if( bExpand )
|
760
|
+
$child.show();
|
761
|
+
else
|
762
|
+
$child.hide(); // TODO: this seems to be slow, when called the first time for an element
|
763
|
+
}
|
730
764
|
}
|
731
765
|
}
|
732
766
|
|
@@ -776,20 +810,18 @@ DynaTreeNode.prototype = {
|
|
776
810
|
onClick: function(event) {
|
777
811
|
// this.tree.logDebug("dtnode.onClick(" + event.type + "): dtnode:" + this + ", button:" + event.button + ", which: " + event.which);
|
778
812
|
var targetType = this.getEventTargetType(event);
|
779
|
-
// if( $(event.target).hasClass(this.tree.options.classNames.expander) ) {
|
780
813
|
if( targetType == "expander" ) {
|
781
814
|
// Clicking the expander icon always expands/collapses
|
782
815
|
this.toggleExpand();
|
783
|
-
|
816
|
+
this.focus(); // issue 95
|
784
817
|
} else if( targetType == "checkbox" ) {
|
785
818
|
// Clicking the checkbox always (de)selects
|
786
819
|
this.toggleSelect();
|
820
|
+
this.focus(); // issue 95
|
787
821
|
} else {
|
788
822
|
this._userActivate();
|
789
823
|
// Chrome and Safari don't focus the a-tag on click
|
790
|
-
// this.tree.logDebug("a tag: ", this.span.getElementsByTagName("a")[0]);
|
791
824
|
this.span.getElementsByTagName("a")[0].focus();
|
792
|
-
// alert("hasFocus=" + this.span.getElementsByTagName("a")[0].focused);
|
793
825
|
}
|
794
826
|
// Make sure that clicks stop, otherwise <a href='#'> jumps to the top
|
795
827
|
return false;
|
@@ -959,9 +991,9 @@ DynaTreeNode.prototype = {
|
|
959
991
|
}
|
960
992
|
},
|
961
993
|
|
962
|
-
removeChildren: function(
|
994
|
+
removeChildren: function(isRecursiveCall) {
|
963
995
|
// Remove all child nodes (more efficiently than recursive remove())
|
964
|
-
// this.tree.logDebug ("%o.removeChildren(%o)", this,
|
996
|
+
// this.tree.logDebug ("%o.removeChildren(%o)", this, isRecursiveCall);
|
965
997
|
var tree = this.tree;
|
966
998
|
var ac = this.childList;
|
967
999
|
if( ac ) {
|
@@ -981,16 +1013,31 @@ DynaTreeNode.prototype = {
|
|
981
1013
|
delete tn;
|
982
1014
|
}
|
983
1015
|
this.childList = null;
|
984
|
-
if( ! recursive ) {
|
985
|
-
this._expand(false);
|
986
|
-
this.isRead = false;
|
987
|
-
this.isLoading = false;
|
988
|
-
this.render(false, false);
|
989
|
-
}
|
990
1016
|
}
|
1017
|
+
if( ! isRecursiveCall ) {
|
1018
|
+
// this._expand(false);
|
1019
|
+
// this.isRead = false;
|
1020
|
+
this.isLoading = false;
|
1021
|
+
this.render(false, false);
|
1022
|
+
}
|
1023
|
+
},
|
1024
|
+
|
1025
|
+
reload: function(force) {
|
1026
|
+
// Discard lazy content (and reload, if node is expanded).
|
1027
|
+
if( ! this.data.isLazy )
|
1028
|
+
throw "node.reload() requires lazy nodes.";
|
1029
|
+
if( this.bExpanded ) {
|
1030
|
+
this.expand(false);
|
1031
|
+
this.removeChildren();
|
1032
|
+
this.expand(true);
|
1033
|
+
} else {
|
1034
|
+
this.removeChildren();
|
1035
|
+
if( force )
|
1036
|
+
this._loadContent();
|
1037
|
+
}
|
991
1038
|
},
|
992
1039
|
|
993
|
-
_addChildNode: function(dtnode,
|
1040
|
+
_addChildNode: function(dtnode, beforeNode) {
|
994
1041
|
/**
|
995
1042
|
* Internal function to add one single DynatreeNode as a child.
|
996
1043
|
*
|
@@ -1001,19 +1048,28 @@ DynaTreeNode.prototype = {
|
|
1001
1048
|
|
1002
1049
|
// tree.logDebug("%o._addChildNode(%o)", this, dtnode);
|
1003
1050
|
|
1004
|
-
// ---
|
1005
|
-
|
1051
|
+
// --- Update and fix dtnode attributes if necessary
|
1052
|
+
dtnode.parent = this;
|
1053
|
+
// if( beforeNode && (beforeNode.parent !== this || beforeNode === dtnode ) )
|
1054
|
+
// throw "<beforeNode> must be another child of <this>";
|
1006
1055
|
|
1056
|
+
// --- Add dtnode as a child
|
1007
1057
|
if ( this.childList==null ) {
|
1008
1058
|
this.childList = [];
|
1009
|
-
} else {
|
1059
|
+
} else if( ! beforeNode ) {
|
1010
1060
|
// Fix 'lastsib'
|
1011
1061
|
$(this.childList[this.childList.length-1].span).removeClass(opts.classNames.lastsib);
|
1012
1062
|
}
|
1013
|
-
|
1014
|
-
|
1015
|
-
|
1016
|
-
|
1063
|
+
if( beforeNode ) {
|
1064
|
+
var iBefore = $.inArray(beforeNode, this.childList);
|
1065
|
+
if( iBefore < 0 )
|
1066
|
+
throw "<beforeNode> must be a child of <this>";
|
1067
|
+
this.childList.splice(iBefore, 0, dtnode);
|
1068
|
+
// alert(this.childList);
|
1069
|
+
} else {
|
1070
|
+
// Append node
|
1071
|
+
this.childList.push(dtnode);
|
1072
|
+
}
|
1017
1073
|
|
1018
1074
|
// --- Handle persistence
|
1019
1075
|
// Initial status is read from cookies, if persistence is active and
|
@@ -1046,6 +1102,14 @@ DynaTreeNode.prototype = {
|
|
1046
1102
|
if( dtnode.bExpanded && opts.persist )
|
1047
1103
|
pers.addExpand(dtnode.data.key);
|
1048
1104
|
dtnode.bSelected = ( dtnode.data.select == true ); // Deselected by default
|
1105
|
+
/*
|
1106
|
+
Doesn't work, cause pers.selectedKeyList may be null
|
1107
|
+
if( dtnode.bSelected && opts.selectMode==1
|
1108
|
+
&& pers.selectedKeyList && pers.selectedKeyList.length>0 ) {
|
1109
|
+
tree.logWarning("Ignored multi-selection in single-mode for %o", dtnode);
|
1110
|
+
dtnode.bSelected = false; // Fixing bad input data (multi selection for mode:1)
|
1111
|
+
}
|
1112
|
+
*/
|
1049
1113
|
if( dtnode.bSelected && opts.persist )
|
1050
1114
|
pers.addSelect(dtnode.data.key);
|
1051
1115
|
}
|
@@ -1078,7 +1142,7 @@ DynaTreeNode.prototype = {
|
|
1078
1142
|
return dtnode;
|
1079
1143
|
},
|
1080
1144
|
|
1081
|
-
addChild: function(obj,
|
1145
|
+
addChild: function(obj, beforeNode) {
|
1082
1146
|
/**
|
1083
1147
|
* Add a node object as child.
|
1084
1148
|
*
|
@@ -1086,7 +1150,7 @@ DynaTreeNode.prototype = {
|
|
1086
1150
|
* (Except for the root node creation in the tree constructor)
|
1087
1151
|
*
|
1088
1152
|
* @param obj A JS object (may be recursive) or an array of those.
|
1089
|
-
* @param {DynaTreeNode}
|
1153
|
+
* @param {DynaTreeNode} beforeNode (optional) sibling node.
|
1090
1154
|
*
|
1091
1155
|
* Data format: array of node objects, with optional 'children' attributes.
|
1092
1156
|
* [
|
@@ -1101,11 +1165,11 @@ DynaTreeNode.prototype = {
|
|
1101
1165
|
* A simple object is also accepted instead of an array.
|
1102
1166
|
*
|
1103
1167
|
*/
|
1104
|
-
// this.tree.logDebug("%o.addChild(%o, %o)", this, obj,
|
1168
|
+
// this.tree.logDebug("%o.addChild(%o, %o)", this, obj, beforeNode);
|
1105
1169
|
if( !obj || obj.length==0 ) // Passed null or undefined or empty array
|
1106
1170
|
return;
|
1107
1171
|
if( obj instanceof DynaTreeNode )
|
1108
|
-
return this._addChildNode(obj,
|
1172
|
+
return this._addChildNode(obj, beforeNode);
|
1109
1173
|
if( !obj.length ) // Passed a single data object
|
1110
1174
|
obj = [ obj ];
|
1111
1175
|
|
@@ -1114,7 +1178,7 @@ DynaTreeNode.prototype = {
|
|
1114
1178
|
var tnFirst = null;
|
1115
1179
|
for (var i=0; i<obj.length; i++) {
|
1116
1180
|
var data = obj[i];
|
1117
|
-
var dtnode = this._addChildNode(new DynaTreeNode(this, this.tree, data),
|
1181
|
+
var dtnode = this._addChildNode(new DynaTreeNode(this, this.tree, data), beforeNode);
|
1118
1182
|
if( !tnFirst ) tnFirst = dtnode;
|
1119
1183
|
// Add child nodes recursively
|
1120
1184
|
if( data.children )
|
@@ -1125,13 +1189,12 @@ DynaTreeNode.prototype = {
|
|
1125
1189
|
},
|
1126
1190
|
|
1127
1191
|
append: function(obj) {
|
1128
|
-
|
1129
|
-
* @deprecated
|
1130
|
-
*/
|
1192
|
+
this.tree.logWarning("node.append() is deprecated (use node.addChild() instead).");
|
1131
1193
|
return this.addChild(obj, null);
|
1132
1194
|
},
|
1133
1195
|
|
1134
1196
|
appendAjax: function(ajaxOptions) {
|
1197
|
+
this.removeChildren();
|
1135
1198
|
this.setLazyNodeStatus(DTNodeStatus_Loading);
|
1136
1199
|
// Ajax option inheritance: $.ajaxSetup < $.ui.dynatree.defaults.ajaxDefaults < tree.options.ajaxDefaults < ajaxOptions
|
1137
1200
|
var self = this;
|
@@ -1142,7 +1205,8 @@ DynaTreeNode.prototype = {
|
|
1142
1205
|
// <this> is the request options
|
1143
1206
|
var prevPhase = self.tree.phase;
|
1144
1207
|
self.tree.phase = "init";
|
1145
|
-
self.append(data);
|
1208
|
+
// self.append(data);
|
1209
|
+
self.addChild(data, null);
|
1146
1210
|
self.tree.phase = "postInit";
|
1147
1211
|
self.setLazyNodeStatus(DTNodeStatus_Ok);
|
1148
1212
|
if( orgSuccess )
|
@@ -1281,14 +1345,14 @@ var DynaTree = Class.create();
|
|
1281
1345
|
|
1282
1346
|
// --- Static members ----------------------------------------------------------
|
1283
1347
|
|
1284
|
-
DynaTree.version = "$Version: 0.5.
|
1285
|
-
|
1348
|
+
DynaTree.version = "$Version: 0.5.1$";
|
1349
|
+
/*
|
1286
1350
|
DynaTree._initTree = function() {
|
1287
1351
|
};
|
1288
1352
|
|
1289
1353
|
DynaTree._bind = function() {
|
1290
1354
|
};
|
1291
|
-
|
1355
|
+
*/
|
1292
1356
|
//--- Class members ------------------------------------------------------------
|
1293
1357
|
|
1294
1358
|
DynaTree.prototype = {
|
@@ -1384,6 +1448,37 @@ DynaTree.prototype = {
|
|
1384
1448
|
this.logDebug("dynatree.redraw() done.");
|
1385
1449
|
},
|
1386
1450
|
|
1451
|
+
reloadAjax: function() {
|
1452
|
+
// Reload
|
1453
|
+
var opts = this.options;
|
1454
|
+
if( ! opts.initAjax || ! opts.initAjax.url )
|
1455
|
+
throw "tree.reload() requires 'initAjax' mode.";
|
1456
|
+
var pers = this.persistence;
|
1457
|
+
var ajaxOpts = $.extend({}, opts.initAjax);
|
1458
|
+
// Append cookie info to the request
|
1459
|
+
if( ajaxOpts.addActiveKey )
|
1460
|
+
ajaxOpts.data.activeKey = pers.activeKey;
|
1461
|
+
if( ajaxOpts.addFocusedKey )
|
1462
|
+
ajaxOpts.data.focusedKey = pers.focusedKey;
|
1463
|
+
if( ajaxOpts.addExpandedKeyList )
|
1464
|
+
ajaxOpts.data.expandedKeyList = pers.expandedKeyList.join(",");
|
1465
|
+
if( ajaxOpts.addSelectedKeyList )
|
1466
|
+
ajaxOpts.data.selectedKeyList = pers.selectedKeyList.join(",");
|
1467
|
+
|
1468
|
+
// Setup onPostInit callback to be called when Ajax returns
|
1469
|
+
if( opts.onPostInit ) {
|
1470
|
+
if( ajaxOpts.success )
|
1471
|
+
this.tree.logWarning("initAjax: success callback is ignored when onPostInit was specified.");
|
1472
|
+
if( ajaxOpts.error )
|
1473
|
+
this.tree.logWarning("initAjax: error callback is ignored when onPostInit was specified.");
|
1474
|
+
var isReloading = pers.isReloading();
|
1475
|
+
ajaxOpts["success"] = function(dtnode) { opts.onPostInit.call(dtnode.tree, isReloading, false); };
|
1476
|
+
ajaxOpts["error"] = function(dtnode) { opts.onPostInit.call(dtnode.tree, isReloading, true); };
|
1477
|
+
}
|
1478
|
+
this.logDebug("Dynatree._init(): send Ajax request...");
|
1479
|
+
this.tnRoot.appendAjax(ajaxOpts);
|
1480
|
+
},
|
1481
|
+
|
1387
1482
|
getRoot: function() {
|
1388
1483
|
return this.tnRoot;
|
1389
1484
|
},
|
@@ -1493,7 +1588,7 @@ TODO: better?
|
|
1493
1588
|
data.tooltip = $li.attr("title");
|
1494
1589
|
if( $li.attr("id") )
|
1495
1590
|
data.key = $li.attr("id");
|
1496
|
-
// If a data attribute is present, evaluate as a
|
1591
|
+
// If a data attribute is present, evaluate as a JavaScript object
|
1497
1592
|
if( $li.attr("data") ) {
|
1498
1593
|
var dataAttr = $.trim($li.attr("data"));
|
1499
1594
|
if( dataAttr ) {
|
@@ -1542,6 +1637,11 @@ $.widget("ui.dynatree", {
|
|
1542
1637
|
|
1543
1638
|
var $this = this.element;
|
1544
1639
|
var opts = this.options;
|
1640
|
+
// If a 'options.classNames' dictionary was passed, still use defaults
|
1641
|
+
// for undefined classes:
|
1642
|
+
if( opts.classNames !== $.ui.dynatree.defaults.classNames ) {
|
1643
|
+
opts.classNames = $.extend({}, $.ui.dynatree.defaults.classNames, opts.classNames);
|
1644
|
+
}
|
1545
1645
|
|
1546
1646
|
// Guess skin path, if not specified
|
1547
1647
|
if(!opts.imagePath) {
|
@@ -1579,33 +1679,12 @@ $.widget("ui.dynatree", {
|
|
1579
1679
|
// Init tree structure
|
1580
1680
|
if( opts.children ) {
|
1581
1681
|
// Read structure from node array
|
1582
|
-
root.
|
1682
|
+
root.addChild(opts.children);
|
1583
1683
|
|
1584
1684
|
} else if( opts.initAjax && opts.initAjax.url ) {
|
1585
1685
|
// Init tree from AJAX request
|
1586
1686
|
isLazy = true;
|
1587
|
-
|
1588
|
-
// Append cookie info to the request
|
1589
|
-
if( ajaxOpts.addActiveKey )
|
1590
|
-
ajaxOpts.data.activeKey = this.tree.persistence.activeKey;
|
1591
|
-
if( ajaxOpts.addFocusedKey )
|
1592
|
-
ajaxOpts.data.focusedKey = this.tree.persistence.focusedKey;
|
1593
|
-
if( ajaxOpts.addExpandedKeyList )
|
1594
|
-
ajaxOpts.data.expandedKeyList = this.tree.persistence.expandedKeyList.join(",");
|
1595
|
-
if( ajaxOpts.addSelectedKeyList )
|
1596
|
-
ajaxOpts.data.selectedKeyList = this.tree.persistence.selectedKeyList.join(",");
|
1597
|
-
|
1598
|
-
// Setup onPostInit callback to be called when Ajax returns
|
1599
|
-
if( opts.onPostInit ) {
|
1600
|
-
if( ajaxOpts.success )
|
1601
|
-
this.tree.logWarning("initAjax: success callback is ignored when onPostInit was specified.");
|
1602
|
-
if( ajaxOpts.error )
|
1603
|
-
this.tree.logWarning("initAjax: error callback is ignored when onPostInit was specified.");
|
1604
|
-
ajaxOpts["success"] = function(dtnode) { opts.onPostInit.call(dtnode.tree, isReloading, false); };
|
1605
|
-
ajaxOpts["error"] = function(dtnode) { opts.onPostInit.call(dtnode.tree, isReloading, true); };
|
1606
|
-
}
|
1607
|
-
this.tree.logDebug("Dynatree._init(): send Ajax request...");
|
1608
|
-
root.appendAjax(ajaxOpts);
|
1687
|
+
this.tree.reloadAjax();
|
1609
1688
|
|
1610
1689
|
} else if( opts.initId ) {
|
1611
1690
|
// Init tree from another UL element
|
@@ -1828,7 +1907,9 @@ $.ui.dynatree.defaults = {
|
|
1828
1907
|
// domain: "jquery.com",
|
1829
1908
|
// secure: true
|
1830
1909
|
},
|
1831
|
-
|
1910
|
+
// Class names used, when rendering the HTML markup.
|
1911
|
+
// Note: if only single entries are passed for options.classNames, all other
|
1912
|
+
// values are still set to default.
|
1832
1913
|
classNames: {
|
1833
1914
|
container: "ui-dynatree-container",
|
1834
1915
|
folder: "ui-dynatree-folder",
|
@@ -1848,7 +1929,7 @@ $.ui.dynatree.defaults = {
|
|
1848
1929
|
combinedExpanderPrefix: "ui-dynatree-exp-",
|
1849
1930
|
combinedIconPrefix: "ui-dynatree-ico-",
|
1850
1931
|
// disabled: "ui-dynatree-disabled",
|
1851
|
-
|
1932
|
+
hasChildren: "ui-dynatree-has-children",
|
1852
1933
|
active: "ui-dynatree-active",
|
1853
1934
|
selected: "ui-dynatree-selected",
|
1854
1935
|
expanded: "ui-dynatree-expanded",
|
@@ -1878,9 +1959,9 @@ $.ui.dynatree.nodedatadefaults = {
|
|
1878
1959
|
focus: false, // Initial focused status.
|
1879
1960
|
expand: false, // Initial expanded status.
|
1880
1961
|
select: false, // Initial selected status.
|
1881
|
-
|
1882
|
-
|
1883
|
-
// disabled:
|
1962
|
+
hideCheckbox: false, // Suppress checkbox display for this node.
|
1963
|
+
unselectable: false, // Prevent selection.
|
1964
|
+
// disabled: false,
|
1884
1965
|
// The following attributes are only valid if passed to some functions:
|
1885
1966
|
children: null, // Array of child nodes.
|
1886
1967
|
// NOTE: we can also add custom attributes here.
|