Properties Methods Events Config Options Direct Link

    Observable
      AbstractSelectionModel
        RowSelectionModel

# Class Ext.grid.RowSelectionModel

Package: | Ext.grid
Defined In: | RowSelectionModel.js
Class: | RowSelectionModel
Subclasses: | CheckboxSelectionModel
Extends: | AbstractSelectionModel

The default SelectionModel used by Ext.grid.GridPanel. It supports multiple selections and keyboard selection/navigation. The objects stored as selections and returned by getSelected, and getSelections are the Records which provide the data for the selected rows.

## Config Options

Config Options | Defined By
--- | ---
| listeners : Object (optional) A config object containing one or more event handlers to be added to this object during initialization. Th... (optional) A config object containing one or more event handlers to be added to this object during initialization. This should be a valid listeners config object as specified in the addListener example for attaching multiple handlers at once. | Observable
| moveEditorOnEnter : Boolean False to turn off moving the editor to the next cell when the enter key is pressed | RowSelectionModel
| singleSelect : Boolean True to allow selection of only one row at a time (defaults to false) | RowSelectionModel

## Public Properties

Property | Defined By
--- | ---
| grid : Object The GridPanel for which this SelectionModel is handling selection. Read-only. | AbstractSelectionModel

## Public Methods

Method | Defined By
--- | ---
| RowSelectionModel( `Object config` ) Parameters: `config` : Object Returns: `` | RowSelectionModel
| addEvents( `Object object` ) : void Used to define events on this Observable Used to define events on this Observable Parameters: `object` : Object The object with the events defined Returns: `void` | Observable
- | addListener( `String eventName`, `Function handler`, [`Object scope`], [`Object options`] ) : void Appends an event handler to this component Appends an event handler to this component Parameters: `eventName` : String The type of event to listen for `handler` : Function The method the event invokes `scope` : Object (optional) The scope (`this` reference) in which the handler function is executed. If omitted, defaults to the object which fired the event. `options` : Object (optional) An object containing handler configuration properties. This may contain any of the following properties: scope : Object The scope (`this` reference) in which the handler function is executed. If omitted, defaults to the object which fired the event. delay : Number The number of milliseconds to delay the invocation of the handler after the event fires. single : Boolean True to add a handler to handle just the next firing of the event, and then remove itself. buffer : Number Causes the handler to be scheduled to run in an Ext.util.DelayedTask delayed by the specified number of milliseconds. If the event fires again within that time, the original handler is not invoked, but the new handler is scheduled in its place. target : Observable Only call the handler if the event was fired on the target Observable, not if the event was bubbled up from a child Observable. Combining Options Using the options argument, it is possible to combine different types of listeners: A delayed, one-time listener.
      myDataView.on('click', this.onClick, this, {
          single: true,
          delay: 100
      });
  Attaching multiple handlers in 1 call The method also allows for a single argument to be passed which is a config object containing properties which specify multiple handlers.
      myGridPanel.on({
          'click' : {
              fn: this.onClick,
              scope: this,
              delay: 100
          },
          'mouseover' : {
              fn: this.onMouseOver,
              scope: this
          },
          'mouseout' : {
              fn: this.onMouseOut,
              scope: this
          }
      });
  Or a shorthand syntax:
      myGridPanel.on({
          'click' : this.onClick,
          'mouseover' : this.onMouseOver,
          'mouseout' : this.onMouseOut,
           scope: this
      });
Returns: `void` | Observable
| clearSelections() : void Clears all selections. Clears all selections. Parameters: None. Returns: `void` | RowSelectionModel
| deselectRange( `Number startRow`, `Number endRow` ) : void Deselects a range of rows. All rows in between startRow and endRow are also deselected. Deselects a range of rows. All rows in between startRow and endRow are also deselected. Parameters: `startRow` : Number The index of the first row in the range `endRow` : Number The index of the last row in the range Returns: `void` | RowSelectionModel
| deselectRow( `Number row` ) : void Deselects a row. Deselects a row. Parameters: `row` : Number The index of the row to deselect Returns: `void` | RowSelectionModel
| each( `Function fn`, [`Object scope`] ) : Boolean Calls the passed function with each selection. If the function returns false, iteration is stopped and this function ... Calls the passed function with each selection. If the function returns false, iteration is stopped and this function returns false. Otherwise it returns true. Parameters: `fn` : Function `scope` : Object (optional) Returns: `Boolean` true if all selections were iterated | RowSelectionModel
| fireEvent( `String eventName`, `Object... args` ) : Boolean Fires the specified event with the passed parameters (minus the event name). Fires the specified event with the passed parameters (minus the event name). Parameters: `eventName` : String `args` : Object... Variable number of parameters are passed to handlers Returns: `Boolean` returns false if any of the handlers return false otherwise it returns true | Observable
| getCount() : Number Gets the number of selected rows. Gets the number of selected rows. Parameters: None. Returns: `Number` | RowSelectionModel
| getSelected() : Record Returns the first selected record. Returns the first selected record. Parameters: None. Returns: `Record` | RowSelectionModel
| getSelections() : Array Returns the selected records Returns the selected records Parameters: None. Returns: `Array` Array of selected records | RowSelectionModel
| hasListener( `String eventName` ) : Boolean Checks to see if this object has any listeners for a specified event Checks to see if this object has any listeners for a specified event Parameters: `eventName` : String The name of the event to check for Returns: `Boolean` True if the event is being listened for, else false | Observable
| hasNext() : Boolean Returns true if there is a next record to select Returns true if there is a next record to select Parameters: None. Returns: `Boolean` | RowSelectionModel
| hasPrevious() : Boolean Returns true if there is a previous record to select Returns true if there is a previous record to select Parameters: None. Returns: `Boolean` | RowSelectionModel
| hasSelection() : Boolean Returns True if there is a selection. Returns True if there is a selection. Parameters: None. Returns: `Boolean` | RowSelectionModel
| isIdSelected( `String id` ) : Boolean Returns True if the specified record id is selected. Returns True if the specified record id is selected. Parameters: `id` : String The id of record to check Returns: `Boolean` | RowSelectionModel
| isLocked() : Boolean Returns true if the selections are locked. Returns true if the selections are locked. Parameters: None. Returns: `Boolean` | AbstractSelectionModel
| isSelected( `Number/Record record` ) : Boolean Returns True if the specified row is selected. Returns True if the specified row is selected. Parameters: `record` : Number/Record The record or index of the record to check Returns: `Boolean` | RowSelectionModel
| lock() : void Locks the selections. Locks the selections. Parameters: None. Returns: `void` | AbstractSelectionModel
| on( `String eventName`, `Function handler`, [`Object scope`], [`Object options`] ) : void Appends an event handler to this element (shorthand for addListener) Appends an event handler to this element (shorthand for addListener) Parameters: `eventName` : String The type of event to listen for `handler` : Function The method the event invokes `scope` : Object (optional) The scope in which to execute the handler function. The handler function's "this" context. `options` : Object (optional) Returns: `void` | Observable
| purgeListeners() : void Removes all listeners for this object Removes all listeners for this object Parameters: None. Returns: `void` | Observable
| relayEvents( `Object o`, `Array events` ) : void Relays selected events from the specified Observable as if the events were fired by `this`. Relays selected events from the specified Observable as if the events were fired by `this`. Parameters: `o` : Object The Observable whose events this object is to relay. `events` : Array Array of event names to relay. Returns: `void` | Observable
| removeListener( `String eventName`, `Function handler`, [`Object scope`] ) : void Removes a listener Removes a listener Parameters: `eventName` : String The type of event to listen for `handler` : Function The handler to remove `scope` : Object (optional) The scope (this object) for the handler Returns: `void` | Observable
| resumeEvents() : void Resume firing events. (see suspendEvents) Resume firing events. (see suspendEvents) Parameters: None. Returns: `void` | Observable
| selectAll() : void Selects all rows. Selects all rows. Parameters: None. Returns: `void` | RowSelectionModel
| selectFirstRow() : void Selects the first row in the grid. Selects the first row in the grid. Parameters: None. Returns: `void` | RowSelectionModel
| selectLastRow( [`Boolean keepExisting`] ) : void Select the last row. Select the last row. Parameters: `keepExisting` : Boolean (optional) True to keep existing selections Returns: `void` | RowSelectionModel
| selectNext( [`Boolean keepExisting`] ) : Boolean Selects the row immediately following the last selected row. Selects the row immediately following the last selected row. Parameters: `keepExisting` : Boolean (optional) True to keep existing selections Returns: `Boolean` True if there is a next row, else false | RowSelectionModel
| selectPrevious( [`Boolean keepExisting`] ) : Boolean Selects the row that precedes the last selected row. Selects the row that precedes the last selected row. Parameters: `keepExisting` : Boolean (optional) True to keep existing selections Returns: `Boolean` True if there is a previous row, else false | RowSelectionModel
| selectRange( `Number startRow`, `Number endRow`, [`Boolean keepExisting`] ) : void Selects a range of rows. All rows in between startRow and endRow are also selected. Selects a range of rows. All rows in between startRow and endRow are also selected. Parameters: `startRow` : Number The index of the first row in the range `endRow` : Number The index of the last row in the range `keepExisting` : Boolean (optional) True to retain existing selections Returns: `void` | RowSelectionModel
| selectRecords( `Array records`, [`Boolean keepExisting`] ) : void Select records. Select records. Parameters: `records` : Array The records to select `keepExisting` : Boolean (optional) True to keep existing selections Returns: `void` | RowSelectionModel
| selectRow( `Number row`, [`Boolean keepExisting`] ) : void Selects a row. Selects a row. Parameters: `row` : Number The index of the row to select `keepExisting` : Boolean (optional) True to keep existing selections Returns: `void` | RowSelectionModel
| selectRows( `Array rows`, [`Boolean keepExisting`] ) : void Selects multiple rows. Selects multiple rows. Parameters: `rows` : Array Array of the indexes of the row to select `keepExisting` : Boolean (optional) True to keep existing selections (defaults to false) Returns: `void` | RowSelectionModel
| suspendEvents() : void Suspend the firing of all events. (see resumeEvents) Suspend the firing of all events. (see resumeEvents) Parameters: None. Returns: `void` | Observable
| un( `String eventName`, `Function handler`, [`Object scope`] ) : void Removes a listener (shorthand for removeListener) Removes a listener (shorthand for removeListener) Parameters: `eventName` : String The type of event to listen for `handler` : Function The handler to remove `scope` : Object (optional) The scope (this object) for the handler Returns: `void` | Observable
| unlock() : void Unlocks the selections. Unlocks the selections. Parameters: None. Returns: `void` | AbstractSelectionModel

## Public Events

Event | Defined By
--- | ---
| beforerowselect : ( `SelectionModel this`, `Number rowIndex`, `Boolean keepExisting`, `Record record` ) Fires when a row is being selected, return false to cancel. Fires when a row is being selected, return false to cancel. Listeners will be called with the following arguments: `this` : SelectionModel `rowIndex` : Number The index to be selected `keepExisting` : Boolean False if other selections will be cleared `record` : Record The record to be selected | RowSelectionModel
| rowdeselect : ( `SelectionModel this`, `Number rowIndex`, `Record record` ) Fires when a row is deselected. Fires when a row is deselected. Listeners will be called with the following arguments: `this` : SelectionModel `rowIndex` : Number `record` : Record | RowSelectionModel
| rowselect : ( `SelectionModel this`, `Number rowIndex`, `Ext.data.Record r` ) Fires when a row is selected. Fires when a row is selected. Listeners will be called with the following arguments: `this` : SelectionModel `rowIndex` : Number The selected index `r` : Ext.data.Record The selected record | RowSelectionModel
| selectionchange : ( `SelectionModel this` ) Fires when the selection changes Fires when the selection changes Listeners will be called with the following arguments: `this` : SelectionModel | RowSelectionModel