Upgrade to ExtJS 3.1.0 - Released 12/16/2009
[extjs.git] / docs / source / TreeSelectionModel.html
index ecb0c87..58cc22b 100644 (file)
@@ -1,17 +1,12 @@
-<html>
-<head>
-  <title>The source code</title>
-    <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
-    <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
-</head>
-<body  onload="prettyPrint();">
-    <pre class="prettyprint lang-js">/*!
- * Ext JS Library 3.0.3
- * Copyright(c) 2006-2009 Ext JS, LLC
- * licensing@extjs.com
- * http://www.extjs.com/license
- */
-<div id="cls-Ext.tree.DefaultSelectionModel"></div>/**\r
+<html>\r
+<head>\r
+  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />    \r
+  <title>The source code</title>\r
+    <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />\r
+    <script type="text/javascript" src="../resources/prettify/prettify.js"></script>\r
+</head>\r
+<body  onload="prettyPrint();">\r
+    <pre class="prettyprint lang-js"><div id="cls-Ext.tree.DefaultSelectionModel"></div>/**\r
  * @class Ext.tree.DefaultSelectionModel\r
  * @extends Ext.util.Observable\r
  * The default single selection for a TreePanel.\r
  * @class Ext.tree.DefaultSelectionModel\r
  * @extends Ext.util.Observable\r
  * The default single selection for a TreePanel.\r
@@ -26,7 +21,7 @@ Ext.tree.DefaultSelectionModel = function(config){
         * @param {DefaultSelectionModel} this\r
         * @param {TreeNode} node the new selection\r
         */\r
         * @param {DefaultSelectionModel} this\r
         * @param {TreeNode} node the new selection\r
         */\r
-       "selectionchange",\r
+       'selectionchange',\r
 \r
        <div id="event-Ext.tree.DefaultSelectionModel-beforeselect"></div>/**\r
         * @event beforeselect\r
 \r
        <div id="event-Ext.tree.DefaultSelectionModel-beforeselect"></div>/**\r
         * @event beforeselect\r
@@ -35,7 +30,7 @@ Ext.tree.DefaultSelectionModel = function(config){
         * @param {TreeNode} node the new selection\r
         * @param {TreeNode} node the old selection\r
         */\r
         * @param {TreeNode} node the new selection\r
         * @param {TreeNode} node the old selection\r
         */\r
-       "beforeselect"\r
+       'beforeselect'\r
    );\r
 \r
     Ext.apply(this, config);\r
    );\r
 \r
     Ext.apply(this, config);\r
@@ -46,7 +41,7 @@ Ext.extend(Ext.tree.DefaultSelectionModel, Ext.util.Observable, {
     init : function(tree){\r
         this.tree = tree;\r
         tree.mon(tree.getTreeEl(), 'keydown', this.onKeyDown, this);\r
     init : function(tree){\r
         this.tree = tree;\r
         tree.mon(tree.getTreeEl(), 'keydown', this.onKeyDown, this);\r
-        tree.on("click", this.onNodeClick, this);\r
+        tree.on('click', this.onNodeClick, this);\r
     },\r
     \r
     onNodeClick : function(node, e){\r
     },\r
     \r
     onNodeClick : function(node, e){\r
@@ -67,12 +62,12 @@ Ext.extend(Ext.tree.DefaultSelectionModel, Ext.util.Observable, {
         if(node == last){\r
             node.ui.onSelectedChange(true);\r
         }else if(this.fireEvent('beforeselect', this, node, last) !== false){\r
         if(node == last){\r
             node.ui.onSelectedChange(true);\r
         }else if(this.fireEvent('beforeselect', this, node, last) !== false){\r
-            if(last){\r
+            if(last && last.ui){\r
                 last.ui.onSelectedChange(false);\r
             }\r
             this.selNode = node;\r
             node.ui.onSelectedChange(true);\r
                 last.ui.onSelectedChange(false);\r
             }\r
             this.selNode = node;\r
             node.ui.onSelectedChange(true);\r
-            this.fireEvent("selectionchange", this, node, last);\r
+            this.fireEvent('selectionchange', this, node, last);\r
         }\r
         return node;\r
     },\r
         }\r
         return node;\r
     },\r
@@ -80,22 +75,26 @@ Ext.extend(Ext.tree.DefaultSelectionModel, Ext.util.Observable, {
     <div id="method-Ext.tree.DefaultSelectionModel-unselect"></div>/**\r
      * Deselect a node.\r
      * @param {TreeNode} node The node to unselect\r
     <div id="method-Ext.tree.DefaultSelectionModel-unselect"></div>/**\r
      * Deselect a node.\r
      * @param {TreeNode} node The node to unselect\r
+     * @param {Boolean} silent True to stop the selectionchange event from firing.\r
      */\r
      */\r
-    unselect : function(node){\r
+    unselect : function(node, silent){\r
         if(this.selNode == node){\r
         if(this.selNode == node){\r
-            this.clearSelections();\r
+            this.clearSelections(silent);\r
         }    \r
     },\r
     \r
     <div id="method-Ext.tree.DefaultSelectionModel-clearSelections"></div>/**\r
      * Clear all selections\r
         }    \r
     },\r
     \r
     <div id="method-Ext.tree.DefaultSelectionModel-clearSelections"></div>/**\r
      * Clear all selections\r
+     * @param {Boolean} silent True to stop the selectionchange event from firing.\r
      */\r
      */\r
-    clearSelections : function(){\r
+    clearSelections : function(silent){\r
         var n = this.selNode;\r
         if(n){\r
             n.ui.onSelectedChange(false);\r
             this.selNode = null;\r
         var n = this.selNode;\r
         if(n){\r
             n.ui.onSelectedChange(false);\r
             this.selNode = null;\r
-            this.fireEvent("selectionchange", this, null);\r
+            if(silent !== true){\r
+                this.fireEvent('selectionchange', this, null);\r
+            }\r
         }\r
         return n;\r
     },\r
         }\r
         return n;\r
     },\r
@@ -223,7 +222,7 @@ Ext.tree.MultiSelectionModel = function(config){
         * @param {MultiSelectionModel} this\r
         * @param {Array} nodes Array of the selected nodes\r
         */\r
         * @param {MultiSelectionModel} this\r
         * @param {Array} nodes Array of the selected nodes\r
         */\r
-       "selectionchange"\r
+       'selectionchange'\r
    );\r
     Ext.apply(this, config);\r
     Ext.tree.MultiSelectionModel.superclass.constructor.call(this);\r
    );\r
     Ext.apply(this, config);\r
     Ext.tree.MultiSelectionModel.superclass.constructor.call(this);\r
@@ -233,7 +232,7 @@ Ext.extend(Ext.tree.MultiSelectionModel, Ext.util.Observable, {
     init : function(tree){\r
         this.tree = tree;\r
         tree.mon(tree.getTreeEl(), 'keydown', this.onKeyDown, this);\r
     init : function(tree){\r
         this.tree = tree;\r
         tree.mon(tree.getTreeEl(), 'keydown', this.onKeyDown, this);\r
-        tree.on("click", this.onNodeClick, this);\r
+        tree.on('click', this.onNodeClick, this);\r
     },\r
     \r
     onNodeClick : function(node, e){\r
     },\r
     \r
     onNodeClick : function(node, e){\r
@@ -263,7 +262,7 @@ Ext.extend(Ext.tree.MultiSelectionModel, Ext.util.Observable, {
         this.selMap[node.id] = node;\r
         this.lastSelNode = node;\r
         node.ui.onSelectedChange(true);\r
         this.selMap[node.id] = node;\r
         this.lastSelNode = node;\r
         node.ui.onSelectedChange(true);\r
-        this.fireEvent("selectionchange", this, this.selNodes);\r
+        this.fireEvent('selectionchange', this, this.selNodes);\r
         return node;\r
     },\r
     \r
         return node;\r
     },\r
     \r
@@ -280,7 +279,7 @@ Ext.extend(Ext.tree.MultiSelectionModel, Ext.util.Observable, {
                 this.selNodes.splice(index, 1);\r
             }\r
             delete this.selMap[node.id];\r
                 this.selNodes.splice(index, 1);\r
             }\r
             delete this.selMap[node.id];\r
-            this.fireEvent("selectionchange", this, this.selNodes);\r
+            this.fireEvent('selectionchange', this, this.selNodes);\r
         }\r
     },\r
     \r
         }\r
     },\r
     \r
@@ -296,7 +295,7 @@ Ext.extend(Ext.tree.MultiSelectionModel, Ext.util.Observable, {
             this.selNodes = [];\r
             this.selMap = {};\r
             if(suppressEvent !== true){\r
             this.selNodes = [];\r
             this.selMap = {};\r
             if(suppressEvent !== true){\r
-                this.fireEvent("selectionchange", this, this.selNodes);\r
+                this.fireEvent('selectionchange', this, this.selNodes);\r
             }\r
         }\r
     },\r
             }\r
         }\r
     },\r
@@ -323,6 +322,6 @@ Ext.extend(Ext.tree.MultiSelectionModel, Ext.util.Observable, {
     selectNext : Ext.tree.DefaultSelectionModel.prototype.selectNext,\r
 \r
     selectPrevious : Ext.tree.DefaultSelectionModel.prototype.selectPrevious\r
     selectNext : Ext.tree.DefaultSelectionModel.prototype.selectNext,\r
 \r
     selectPrevious : Ext.tree.DefaultSelectionModel.prototype.selectPrevious\r
-});</pre>
-</body>
+});</pre>    \r
+</body>\r
 </html>
\ No newline at end of file
 </html>
\ No newline at end of file