X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/c930e9176a5a85509c5b0230e2bff5c22a591432..25ef3491bd9ae007ff1fc2b0d7943e6eaaccf775:/docs/source/TreeSelectionModel.html diff --git a/docs/source/TreeSelectionModel.html b/docs/source/TreeSelectionModel.html index 7dd0738a..ecb0c876 100644 --- a/docs/source/TreeSelectionModel.html +++ b/docs/source/TreeSelectionModel.html @@ -1,11 +1,17 @@ - - - The source code - - - - -
/** + + + The source code + + + + +
/*!
+ * Ext JS Library 3.0.3
+ * Copyright(c) 2006-2009 Ext JS, LLC
+ * licensing@extjs.com
+ * http://www.extjs.com/license
+ */
+
/** * @class Ext.tree.DefaultSelectionModel * @extends Ext.util.Observable * The default single selection for a TreePanel. @@ -39,7 +45,7 @@ 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.mon(tree.getTreeEl(), 'keydown', this.onKeyDown, this); tree.on("click", this.onNodeClick, this); }, @@ -52,7 +58,11 @@ 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); @@ -111,24 +121,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 +147,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; } }); @@ -222,7 +232,7 @@ 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.mon(tree.getTreeEl(), 'keydown', this.onKeyDown, this); tree.on("click", this.onNodeClick, this); }, @@ -313,6 +323,6 @@ Ext.extend(Ext.tree.MultiSelectionModel, Ext.util.Observable, { selectNext : Ext.tree.DefaultSelectionModel.prototype.selectNext, selectPrevious : Ext.tree.DefaultSelectionModel.prototype.selectPrevious -});
- +});
+ \ No newline at end of file