/*!
- * Ext JS Library 3.0.3
- * Copyright(c) 2006-2009 Ext JS, LLC
+ * Ext JS Library 3.1.1
+ * Copyright(c) 2006-2010 Ext JS, LLC
* licensing@extjs.com
* http://www.extjs.com/license
*/
* @param {DefaultSelectionModel} this\r
* @param {TreeNode} node the new selection\r
*/\r
- "selectionchange",\r
+ 'selectionchange',\r
\r
/**\r
* @event beforeselect\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
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
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
- this.fireEvent("selectionchange", this, node, last);\r
+ this.fireEvent('selectionchange', this, node, last);\r
}\r
return node;\r
},\r
/**\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
- unselect : function(node){\r
+ unselect : function(node, silent){\r
if(this.selNode == node){\r
- this.clearSelections();\r
+ this.clearSelections(silent);\r
} \r
},\r
\r
/**\r
* Clear all selections\r
+ * @param {Boolean} silent True to stop the selectionchange event from firing.\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
- this.fireEvent("selectionchange", this, null);\r
+ if(silent !== true){\r
+ this.fireEvent('selectionchange', this, null);\r
+ }\r
}\r
return n;\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
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
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
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
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