Upgrade to ExtJS 4.0.7 - Released 10/19/2011
[extjs.git] / docs / source / RowModel.html
index 45a2629..3cc6c8b 100644 (file)
@@ -3,8 +3,8 @@
 <head>
   <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
   <title>The source code</title>
-  <link href="../prettify/prettify.css" type="text/css" rel="stylesheet" />
-  <script type="text/javascript" src="../prettify/prettify.js"></script>
+  <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
+  <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
   <style type="text/css">
     .highlight { display: block; background-color: #ddd; }
   </style>
   <pre class="prettyprint lang-js"><span id='Ext-selection-RowModel'>/**
 </span> * @class Ext.selection.RowModel
  * @extends Ext.selection.Model
- *
- * Implement row based navigation via keyboard.
- *
- * Must synchronize across grid sections
  */
 Ext.define('Ext.selection.RowModel', {
     extend: 'Ext.selection.Model',
@@ -38,9 +34,17 @@ Ext.define('Ext.selection.RowModel', {
 <span id='Ext-selection-RowModel-cfg-enableKeyNav'>    /**
 </span>     * @cfg {Boolean} enableKeyNav
      *
-     * Turns on/off keyboard navigation within the grid. Defaults to true.
+     * Turns on/off keyboard navigation within the grid.
      */
     enableKeyNav: true,
+    
+<span id='Ext-selection-RowModel-cfg-ignoreRightMouseSelection'>    /**
+</span>     * @cfg {Boolean} [ignoreRightMouseSelection=true]
+     * True to ignore selections that are made when using the right mouse button if there are
+     * records that are already selected. If no records are selected, selection will continue 
+     * as normal
+     */
+    ignoreRightMouseSelection: true,
 
     constructor: function(){
         this.addEvents(
@@ -48,7 +52,7 @@ Ext.define('Ext.selection.RowModel', {
 </span>             * @event beforedeselect
              * Fired before a record is deselected. If any listener returns false, the
              * deselection is cancelled.
-             * @param {Ext.selection.RowSelectionModel} this
+             * @param {Ext.selection.RowModel} this
              * @param {Ext.data.Model} record The deselected record
              * @param {Number} index The row index deselected
              */
@@ -58,7 +62,7 @@ Ext.define('Ext.selection.RowModel', {
 </span>             * @event beforeselect
              * Fired before a record is selected. If any listener returns false, the
              * selection is cancelled.
-             * @param {Ext.selection.RowSelectionModel} this
+             * @param {Ext.selection.RowModel} this
              * @param {Ext.data.Model} record The selected record
              * @param {Number} index The row index selected
              */
@@ -67,7 +71,7 @@ Ext.define('Ext.selection.RowModel', {
 <span id='Ext-selection-RowModel-event-deselect'>            /**
 </span>             * @event deselect
              * Fired after a record is deselected
-             * @param {Ext.selection.RowSelectionModel} this
+             * @param {Ext.selection.RowModel} this
              * @param {Ext.data.Model} record The deselected record
              * @param {Number} index The row index deselected
              */
@@ -76,7 +80,7 @@ Ext.define('Ext.selection.RowModel', {
 <span id='Ext-selection-RowModel-event-select'>            /**
 </span>             * @event select
              * Fired after a record is selected
-             * @param {Ext.selection.RowSelectionModel} this
+             * @param {Ext.selection.RowModel} this
              * @param {Ext.data.Model} record The selected record
              * @param {Number} index The row index selected
              */
@@ -357,8 +361,26 @@ Ext.define('Ext.selection.RowModel', {
     // we can take into account ctrlKey, shiftKey, etc
     onRowMouseDown: function(view, record, item, index, e) {
         view.el.focus();
+        if (!this.allowRightMouseSelection(e)) {
+            return;
+        }
         this.selectWithEvent(record, e);
     },
+    
+<span id='Ext-selection-RowModel-method-allowRightMouseSelection'>    /**
+</span>     * Checks whether a selection should proceed based on the ignoreRightMouseSelection
+     * option.
+     * @private
+     * @param {Ext.EventObject} e The event
+     * @return {Boolean} False if the selection should not proceed
+     */
+    allowRightMouseSelection: function(e) {
+        var disallow = this.ignoreRightMouseSelection &amp;&amp; e.button !== 0;
+        if (disallow) {
+            disallow = this.hasSelection();
+        }
+        return !disallow;
+    },
 
     // Allow the GridView to update the UI by
     // adding/removing a CSS class from the row.