X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/c930e9176a5a85509c5b0230e2bff5c22a591432..10a866c12701c0a0afd0ac85dcdcf32a421514ac:/docs/source/TreeSelectionModel.html?ds=sidebyside
diff --git a/docs/source/TreeSelectionModel.html b/docs/source/TreeSelectionModel.html
index 7dd0738a..58cc22be 100644
--- a/docs/source/TreeSelectionModel.html
+++ b/docs/source/TreeSelectionModel.html
@@ -1,5 +1,6 @@
+
The source code
@@ -20,7 +21,7 @@ Ext.tree.DefaultSelectionModel = function(config){
* @param {DefaultSelectionModel} this
* @param {TreeNode} node the new selection
*/
- "selectionchange",
+ 'selectionchange',
/**
* @event beforeselect
@@ -29,7 +30,7 @@ Ext.tree.DefaultSelectionModel = function(config){
* @param {TreeNode} node the new selection
* @param {TreeNode} node the old selection
*/
- "beforeselect"
+ 'beforeselect'
);
Ext.apply(this, config);
@@ -39,8 +40,8 @@ Ext.tree.DefaultSelectionModel = function(config){
Ext.extend(Ext.tree.DefaultSelectionModel, Ext.util.Observable, {
init : function(tree){
this.tree = tree;
- tree.getTreeEl().on("keydown", this.onKeyDown, this);
- tree.on("click", this.onNodeClick, this);
+ tree.mon(tree.getTreeEl(), 'keydown', this.onKeyDown, this);
+ tree.on('click', this.onNodeClick, this);
},
onNodeClick : function(node, e){
@@ -52,17 +53,21 @@ Ext.extend(Ext.tree.DefaultSelectionModel, Ext.util.Observable, {
* @param {TreeNode} node The node to select
* @return {TreeNode} The selected node
*/
- select : function(node){
+ select : function(node, /* private*/ selectNextNode){
+ // If node is hidden, select the next node in whatever direction was being moved in.
+ if (!Ext.fly(node.ui.wrap).isVisible() && selectNextNode) {
+ return selectNextNode.call(this, node);
+ }
var last = this.selNode;
if(node == last){
node.ui.onSelectedChange(true);
}else if(this.fireEvent('beforeselect', this, node, last) !== false){
- if(last){
+ if(last && last.ui){
last.ui.onSelectedChange(false);
}
this.selNode = node;
node.ui.onSelectedChange(true);
- this.fireEvent("selectionchange", this, node, last);
+ this.fireEvent('selectionchange', this, node, last);
}
return node;
},
@@ -70,22 +75,26 @@ Ext.extend(Ext.tree.DefaultSelectionModel, Ext.util.Observable, {
/**
* Deselect a node.
* @param {TreeNode} node The node to unselect
+ * @param {Boolean} silent True to stop the selectionchange event from firing.
*/
- unselect : function(node){
+ unselect : function(node, silent){
if(this.selNode == node){
- this.clearSelections();
+ this.clearSelections(silent);
}
},
/**
* Clear all selections
+ * @param {Boolean} silent True to stop the selectionchange event from firing.
*/
- clearSelections : function(){
+ clearSelections : function(silent){
var n = this.selNode;
if(n){
n.ui.onSelectedChange(false);
this.selNode = null;
- this.fireEvent("selectionchange", this, null);
+ if(silent !== true){
+ this.fireEvent('selectionchange', this, null);
+ }
}
return n;
},
@@ -111,24 +120,24 @@ Ext.extend(Ext.tree.DefaultSelectionModel, Ext.util.Observable, {
* Selects the node above the selected node in the tree, intelligently walking the nodes
* @return TreeNode The new selection
*/
- selectPrevious : function(){
- var s = this.selNode || this.lastSelNode;
- if(!s){
+ selectPrevious : function(/* private */ s){
+ if(!(s = s || this.selNode || this.lastSelNode)){
return null;
}
+ // Here we pass in the current function to select to indicate the direction we're moving
var ps = s.previousSibling;
if(ps){
if(!ps.isExpanded() || ps.childNodes.length < 1){
- return this.select(ps);
+ return this.select(ps, this.selectPrevious);
} else{
var lc = ps.lastChild;
- while(lc && lc.isExpanded() && lc.childNodes.length > 0){
+ while(lc && lc.isExpanded() && Ext.fly(lc.ui.wrap).isVisible() && lc.childNodes.length > 0){
lc = lc.lastChild;
}
- return this.select(lc);
+ return this.select(lc, this.selectPrevious);
}
} else if(s.parentNode && (this.tree.rootVisible || !s.parentNode.isRoot)){
- return this.select(s.parentNode);
+ return this.select(s.parentNode, this.selectPrevious);
}
return null;
},
@@ -137,20 +146,20 @@ Ext.extend(Ext.tree.DefaultSelectionModel, Ext.util.Observable, {
* Selects the node above the selected node in the tree, intelligently walking the nodes
* @return TreeNode The new selection
*/
- selectNext : function(){
- var s = this.selNode || this.lastSelNode;
- if(!s){
+ selectNext : function(/* private */ s){
+ if(!(s = s || this.selNode || this.lastSelNode)){
return null;
}
- if(s.firstChild && s.isExpanded()){
- return this.select(s.firstChild);
+ // Here we pass in the current function to select to indicate the direction we're moving
+ if(s.firstChild && s.isExpanded() && Ext.fly(s.ui.wrap).isVisible()){
+ return this.select(s.firstChild, this.selectNext);
}else if(s.nextSibling){
- return this.select(s.nextSibling);
+ return this.select(s.nextSibling, this.selectNext);
}else if(s.parentNode){
var newS = null;
s.parentNode.bubble(function(){
if(this.nextSibling){
- newS = this.getOwnerTree().selModel.select(this.nextSibling);
+ newS = this.getOwnerTree().selModel.select(this.nextSibling, this.selectNext);
return false;
}
});
@@ -213,7 +222,7 @@ Ext.tree.MultiSelectionModel = function(config){
* @param {MultiSelectionModel} this
* @param {Array} nodes Array of the selected nodes
*/
- "selectionchange"
+ 'selectionchange'
);
Ext.apply(this, config);
Ext.tree.MultiSelectionModel.superclass.constructor.call(this);
@@ -222,8 +231,8 @@ Ext.tree.MultiSelectionModel = function(config){
Ext.extend(Ext.tree.MultiSelectionModel, Ext.util.Observable, {
init : function(tree){
this.tree = tree;
- tree.getTreeEl().on("keydown", this.onKeyDown, this);
- tree.on("click", this.onNodeClick, this);
+ tree.mon(tree.getTreeEl(), 'keydown', this.onKeyDown, this);
+ tree.on('click', this.onNodeClick, this);
},
onNodeClick : function(node, e){
@@ -253,7 +262,7 @@ Ext.extend(Ext.tree.MultiSelectionModel, Ext.util.Observable, {
this.selMap[node.id] = node;
this.lastSelNode = node;
node.ui.onSelectedChange(true);
- this.fireEvent("selectionchange", this, this.selNodes);
+ this.fireEvent('selectionchange', this, this.selNodes);
return node;
},
@@ -270,7 +279,7 @@ Ext.extend(Ext.tree.MultiSelectionModel, Ext.util.Observable, {
this.selNodes.splice(index, 1);
}
delete this.selMap[node.id];
- this.fireEvent("selectionchange", this, this.selNodes);
+ this.fireEvent('selectionchange', this, this.selNodes);
}
},
@@ -286,7 +295,7 @@ Ext.extend(Ext.tree.MultiSelectionModel, Ext.util.Observable, {
this.selNodes = [];
this.selMap = {};
if(suppressEvent !== true){
- this.fireEvent("selectionchange", this, this.selNodes);
+ this.fireEvent('selectionchange', this, this.selNodes);
}
}
},