<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',
<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(
</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
*/
</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
*/
<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
*/
<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
*/
// 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 && 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.