ExtReact Docs Help

Introduction

The documentation for the ExtReact product diverges somewhat from the documentation of other Sencha products. The sections below describe documentation for all products except where indicated as unique to ExtReact.

Terms, Icons, and Labels

Many classes have shortcut names used when creating (instantiating) a class with a configuration object. The shortcut name is referred to as an alias (or xtype if the class extends Ext.Component). The alias/xtype is listed next to the class name of applicable classes for quick reference.

ExtReact component classes list the configurable name prominently at the top of the API class doc followed by the fully-qualified class name.

Access Levels

Framework classes or their members may be specified as private or protected. Else, the class / member is public. Public, protected, and private are access descriptors used to convey how and when the class or class member should be used.

Member Types

Member Syntax

Below is an example class member that we can disect to show the syntax of a class member (the lookupComponent method as viewed from the Ext.button.Button class in this case).

lookupComponent ( item ) : Ext.Component
protected

Called when a raw config object is added to this container either during initialization of the items config, or when new items are added), or {@link #insert inserted.

This method converts the passed object into an instanced child component.

This may be overridden in subclasses when special processing needs to be applied to child creation.

Parameters

item :  Object

The config object being added.

Returns
Ext.Component

The component to be added.

Let's look at each part of the member row:

Member Flags

The API documentation uses a number of flags to further commnicate the class member's function and intent. The label may be represented by a text label, an abbreviation, or an icon.

Class Icons

- Indicates a framework class

- A singleton framework class. *See the singleton flag for more information

- A component-type framework class (any class within the Ext JS framework that extends Ext.Component)

- Indicates that the class, member, or guide is new in the currently viewed version

Member Icons

- Indicates a class member of type config

Or in the case of an ExtReact component class this indicates a member of type prop

- Indicates a class member of type property

- Indicates a class member of type method

- Indicates a class member of type event

- Indicates a class member of type theme variable

- Indicates a class member of type theme mixin

- Indicates that the class, member, or guide is new in the currently viewed version

Class Member Quick-Nav Menu

Just below the class name on an API doc page is a row of buttons corresponding to the types of members owned by the current class. Each button shows a count of members by type (this count is updated as filters are applied). Clicking the button will navigate you to that member section. Hovering over the member-type button will reveal a popup menu of all members of that type for quick navigation.

Getter and Setter Methods

Getting and setter methods that correlate to a class config option will show up in the methods section as well as in the configs section of both the API doc and the member-type menus just beneath the config they work with. The getter and setter method documentation will be found in the config row for easy reference.

ExtReact component classes do not hoist the getter / setter methods into the prop. All methods will be described in the Methods section

History Bar

Your page history is kept in localstorage and displayed (using the available real estate) just below the top title bar. By default, the only search results shown are the pages matching the product / version you're currently viewing. You can expand what is displayed by clicking on the button on the right-hand side of the history bar and choosing the "All" radio option. This will show all recent pages in the history bar for all products / versions.

Within the history config menu you will also see a listing of your recent page visits. The results are filtered by the "Current Product / Version" and "All" radio options. Clicking on the button will clear the history bar as well as the history kept in local storage.

If "All" is selected in the history config menu the checkbox option for "Show product details in the history bar" will be enabled. When checked, the product/version for each historic page will show alongside the page name in the history bar. Hovering the cursor over the page names in the history bar will also show the product/version as a tooltip.

Search and Filters

Both API docs and guides can be searched for using the search field at the top of the page.

On API doc pages there is also a filter input field that filters the member rows using the filter string. In addition to filtering by string you can filter the class members by access level, inheritance, and read only. This is done using the checkboxes at the top of the page.

The checkbox at the bottom of the API class navigation tree filters the class list to include or exclude private classes.

Clicking on an empty search field will show your last 10 searches for quick navigation.

API Doc Class Metadata

Each API doc page (with the exception of Javascript primitives pages) has a menu view of metadata relating to that class. This metadata view will have one or more of the following:

Expanding and Collapsing Examples and Class Members

Runnable examples (Fiddles) are expanded on a page by default. You can collapse and expand example code blocks individually using the arrow on the top-left of the code block. You can also toggle the collapse state of all examples using the toggle button on the top-right of the page. The toggle-all state will be remembered between page loads.

Class members are collapsed on a page by default. You can expand and collapse members using the arrow icon on the left of the member row or globally using the expand / collapse all toggle button top-right.

Desktop -vs- Mobile View

Viewing the docs on narrower screens or browsers will result in a view optimized for a smaller form factor. The primary differences between the desktop and "mobile" view are:

Viewing the Class Source

The class source can be viewed by clicking on the class name at the top of an API doc page. The source for class members can be viewed by clicking on the "view source" link on the right-hand side of the member row.

ExtReact 6.7.0


top

Ext.grid.selection.Model alias: selmodel.grid, selmodel.grid

NPM Package

@sencha/ext-react

Hierarchy

Requires

Ext.grid.Location
Ext.grid.selection.*

Summary

A selection model for Grid which allows you to select data in a spreadsheet-like manner.

Supported features:

  • Single / Range / Multiple individual row selection.
  • Single / Range cell selection.
  • Column selection by click selecting column headers.
  • Select / deselect all by clicking in the top-left, header.
  • Adds row number column to enable row selection.
  • Optionally you can enable row selection using checkboxes

Using Ext.data.virtual.Stores

It is very important to remember that a Ext.data.virtual.Store does not contain the full dataset. The purpose of a VirtualStore is to only hold in the client, a range of pages from the dataset that corresponds with what is currently visible in the grid (plus a few pages above and below the visible range to allow fast scrolling).

When using "select all" rows and a VirtualStore, an allSelected flag is set, and so all records which are read into the client side cache will thenceforth be selected, and will be rendered as selected in the grid.

But records which have not been read into the cache will obviously not be available when interrogating selected records. What is stored as being selected is row index ranges.

No members found using the current filters

configs

Optional Configs

cells : Boolean

Set to true to enable selection of individual cells or a single rectangular range of cells. This will provide cell range selection using click, and potentially drag to select a rectangular range if (@link #cfg!drag} is true. You can also use "SHIFT + arrow" key navigation to select a range of cells.

Defaults to:

false

getCells : Boolean

Returns the value of cells

Returns

Boolean

setCells (cells)

Sets the value of cells

Parameters

cells :  Boolean

cells : Boolean

Set to true to enable selection of individual cells or a single rectangular range of cells. This will provide cell range selection using click, and potentially drag to select a rectangular range if (@link #cfg!dragSelect} is true. You can also use "SHIFT + arrow" key navigation to select a range of cells.

Defaults to:

false

getCells : Boolean

Returns the value of cells

Returns

Boolean

setCells (cells)

Sets the value of cells

Parameters

cells :  Boolean

checkbox : Boolean

Configure as true to include a checkbox to indicate selection of Records. The checkbox cell plays no part in cell or column selection apart from being a selected cell and part of any iteration through selections.

See headerCheckbox for inclusion of a "select all" checkbox in the column header of the checkbox column.

See checkboxDefaults for how to influence the configuration of the checkbox column header.

Defaults to:

false

getCheckbox : Boolean

Returns the value of checkbox

Returns

Boolean

setCheckbox (checkbox)

Sets the value of checkbox

Parameters

checkbox :  Boolean

checkbox : Boolean

Configure as true to include a checkbox to indicate selection of Records. The checkbox cell plays no part in cell or column selection apart from being a selected cell and part of any iteration through selections.

See headerCheckbox for inclusion of a "select all" checkbox in the column header of the checkbox column.

See checkboxDefaults for how to influence the configuration of the checkbox column header.

Defaults to:

false

getCheckbox : Boolean

Returns the value of checkbox

Returns

Boolean

setCheckbox (checkbox)

Sets the value of checkbox

Parameters

checkbox :  Boolean

checkboxColumnIndex : Number / String

The index at which to insert the checkbox column. Supported values are a numeric index, and the strings 'first' and 'last'. Only valid when set before render.

Defaults to:

0

checkboxColumnIndex : Number / String

The index at which to insert the checkbox column. Supported values are a numeric index, and the strings 'first' and 'last'. Only valid when set before render.

Defaults to:

0

checkboxDefaults : Object

A config object to configure the checkbox column header if checkbox is set.

Defaults to:

{
    xtype: 'selectioncolumn',
    text: null,
    width: 30
}

getCheckboxDefaults : Object

Returns the value of checkboxDefaults

Returns

Object

setCheckboxDefaults (checkboxDefaults)

Sets the value of checkboxDefaults

Parameters

checkboxDefaults :  Object

checkboxDefaults : Object

A config object to configure the checkbox column header if checkbox is set.

getCheckboxDefaults : Object

Returns the value of checkboxDefaults

Returns

Object

setCheckboxDefaults (checkboxDefaults)

Sets the value of checkboxDefaults

Parameters

checkboxDefaults :  Object

checkboxSelect : Boolean

Enables selection of the row via clicking on checkbox. Note: this feature will add new column at position specified by checkboxColumnIndex.

Defaults to:

false

checkboxSelect : Boolean

[checkboxSelect=false] Enables selection of the row via clicking on checkbox. Note: this feature will add new column at position specified by checkboxColumnIndex.

columns : Boolean

Set to true to enable selection of columns.

NOTE: This will disable sorting on header click and instead provide column selection and deselection. Sorting is still available via column header menu.

Defaults to:

false

getColumns : Boolean

Returns the value of columns

Returns

Boolean

setColumns (columns)

Sets the value of columns

Parameters

columns :  Boolean

columns : Boolean

Set to true to enable selection of columns.

NOTE: This will disable sorting on header click and instead provide column selection and deselection. Sorting is still available via column header menu.

Defaults to:

false

getColumns : Boolean

Returns the value of columns

Returns

Boolean

setColumns (columns)

Sets the value of columns

Parameters

columns :  Boolean

deselectable : Boolean

Allow users to deselect the last selected record in a DataView and reduce the selected record count to zero. Configure this as false if there must always be at least one record selected.

Defaults to:

true

getDeselectable : Boolean

Returns the value of deselectable

Returns

Boolean

setDeselectable (deselectable)

Sets the value of deselectable

Parameters

deselectable :  Boolean

disabled : Boolean

Set to true to disable selection. This configuration will lock the selection model that the DataView uses.

Defaults to:

null

getDisabled : Boolean

Returns the value of disabled

Returns

Boolean

setDisabled (disabled)

Sets the value of disabled

Parameters

disabled :  Boolean

drag : Boolean

Set to true to enables cell and row range selection by dragging.

Defaults to:

false

getDrag : Boolean

Returns the value of drag

Returns

Boolean

setDrag (drag)

Sets the value of drag

Parameters

drag :  Boolean

dragSelect : Boolean

Set to true to enables cell and row range selection by dragging.

Defaults to:

true

getDragSelect : Boolean

Returns the value of dragSelect

Returns

Boolean

setDragSelect (dragSelect)

Sets the value of dragSelect

Parameters

dragSelect :  Boolean

extensible : String

This configures whether this selection model is to implement a mouse based dragging gesture to extend a contiguous selection.

Note that if there are multiple, discontiguous selected rows or columns, selection extension is not available.

If set, then the bottom right corner of the contiguous selection will display a drag handle. By dragging this, an extension area may be defined into which the selection is extended.

The beforeselectionextend event fires at the end of the drag though the owning grid. Event handlers may manipulate the store data in any way.

Possible values for this configuration are

  • "x" Only allow extending the block to the left or right.
  • "y" Only allow extending the block above or below.
  • "xy" Allow extending the block in both dimensions.
  • "both" Allow extending the block in both dimensions.
  • true Allow extending the block in both dimensions.
  • false Disable the extensible feature
  • null Disable the extensible feature

It's important to notice that setting this to "both", "xy" or true will allow you to extend the selection in both directions, but only one direction at a time. It will NOT be possible to drag it diagonally.

Defaults to:

false

getExtensible : String

Returns the value of extensible

Returns

String

setExtensible (extensible)

Sets the value of extensible

Parameters

extensible :  String

extensible : String

This configures whether this selection model is to implement a mouse based dragging gesture to extend a contiguous selection.

Note that if there are multiple, discontiguous selected rows or columns, selection extension is not available.

If set, then the bottom right corner of the contiguous selection will display a drag handle. By dragging this, an extension area may be defined into which the selection is extended.

Upon the end of the drag, the beforeselectionextend event will be fired though the encapsulating grid. Event handlers may manipulate the store data in any way.

Possible values for this configuration are

  • "x" Only allow extending the block to the left or right.
  • "y" Only allow extending the block above or below.
  • "xy" Allow extending the block in both dimensions.
  • "both" Allow extending the block in both dimensions.
  • true Allow extending the block in both dimensions.
  • false Disable the extensible feature
  • null Disable the extensible feature

It's important to notice that setting this to "both", "xy" or true will allow you to extend the selection in both directions, but only one direction at a time. It will NOT be possible to drag it diagonally.

Defaults to:

false

getExtensible : String

Returns the value of extensible

Returns

String

setExtensible (extensible)

Sets the value of extensible

Parameters

extensible :  String

headerCheckbox : Boolean

Configure as false to not display the header checkbox at the top of the checkbox column when checkboxSelect is set.

Defaults to:

true

getHeaderCheckbox : Boolean

Returns the value of headerCheckbox

Returns

Boolean

setHeaderCheckbox (headerCheckbox)

Sets the value of headerCheckbox

Parameters

headerCheckbox :  Boolean

headerCheckbox : Boolean

Configure as false to not display the header checkbox at the top of the checkbox column when checkboxSelect is set.

Defaults to:

true

getHeaderCheckbox : Boolean

Returns the value of headerCheckbox

Returns

Boolean

setHeaderCheckbox (headerCheckbox)

Sets the value of headerCheckbox

Parameters

headerCheckbox :  Boolean

listeners : Object

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.

DOM events from Ext JS Ext.Component

While some Ext JS Component classes export selected DOM events (e.g. "click", "mouseover" etc), this is usually only done when extra value can be added. For example the DataView's itemclick event passing the node clicked on. To access DOM events directly from a child element of a Component, we need to specify the element option to identify the Component property to add a DOM listener to:

new Ext.panel.Panel({
    width: 400,
    height: 200,
    dockedItems: [{
        xtype: 'toolbar'
    }],
    listeners: {
        click: {
            element: 'el', //bind to the underlying el property on the panel
            fn: function(){ console.log('click el'); }
        },
        dblclick: {
            element: 'body', //bind to the underlying body property on the panel
            fn: function(){ console.log('dblclick body'); }
        }
    }
});

setListeners ( listeners )

An alias for addListener. In versions prior to 5.1, listeners had a generated setter which could be called to add listeners. In 5.1 the listeners config is not processed using the config system and has no generated setter, so this method is provided for backward compatibility. The preferred way of adding listeners is to use the on method.

Parameters

listeners :  Object

The listeners

mode : 'single' / 'simple' / 'multi'

Modes of selection. Valid values are:

  • "single" - Only allows selecting one item at a time. Use deselectable to allow deselecting that item. Also see toggleOnClick. This is the default.
  • "simple" - Allows simple selection of multiple items one-by-one. Each click in grid will either select or deselect an item.
  • "multi" - Allows complex selection of multiple items using Ctrl and Shift keys.

Defaults to:

'single'

getMode : 'single' / 'simple' / 'multi'

Returns the value of mode

Returns

'single' / 'simple' / 'multi'

setMode (mode)

Sets the value of mode

Parameters

mode :  'single' / 'simple' / 'multi'

publishes : String / String[] / Object

One or more names of config properties that this component should publish to its ViewModel. Generally speaking, only properties defined in a class config block (including ancestor config blocks and mixins) are eligible for publishing to the viewModel. Some components override this and publish their most useful configs by default.

Note: We'll discuss publishing properties not found in the config block below.

Values determined to be invalid by component (often form fields and model validations) will not be published to the ViewModel.

This config uses the reference to determine the name of the data object to place in the ViewModel. If reference is not set then this config is ignored.

By using this config and reference you can bind configs between components. For example:

 ...
     items: [{
         xtype: 'textfield',
         reference: 'somefield',  // component's name in the ViewModel
         publishes: 'value' // value is not published by default
     },{
         ...
     },{
         xtype: 'displayfield',
         bind: 'You have entered "{somefield.value}"'
     }]
 ...

Classes must provide this config as an Object:

 Ext.define('App.foo.Bar', {
     publishes: {
         foo: true,
         bar: true
     }
 });

This is required for the config system to properly merge values from derived classes.

For instances this value can be specified as a value as show above or an array or object as follows:

 {
     xtype: 'textfield',
     reference: 'somefield',
     publishes: [
         'value',
         'rawValue',
         'dirty'
     ]
 }

 // This achieves the same result as the above array form.
 {
     xtype: 'textfield',
     reference: 'somefield',
     publishes: {
         value: true,
         rawValue: true,
         dirty: true
     }
 }

In some cases, users may want to publish a property to the viewModel that is not found in a class config block. In these situations, you may utilize publishState if the property has a setter method. Let's use setFieldLabel as an example:

  setFieldLabel: function(fieldLabel) {
      this.callParent(arguments);
      this.publishState('fieldLabel', fieldLabel);
  }

With the above chunk of code, fieldLabel may now be published to the viewModel.

Defaults to:

'checked'

reducible : Boolean

This configures if the extensible config is also allowed to reduce its selection

Note: This is only relevant if extensible is not false or null

Defaults to:

true

Available since: 6.6.0

getReducible : Boolean

Returns the value of reducible

Returns

Boolean

setReducible (reducible)

Sets the value of reducible

Parameters

reducible :  Boolean

rows : Boolean

Set to true to enable selection of rows by clicking on the selection model's checkbox column, rowNumbers or, if drag is true, by swiping down the rowNumbers.

Defaults to:

true

getRows : Boolean

Returns the value of rows

Returns

Boolean

setRows (rows)

Sets the value of rows

Parameters

rows :  Boolean

rows : Boolean

Set to true to enable selection of rows by clicking on the selection model's checkbox column, rowNumbers, or, if (@link #cfg!dragSelect} is true, by swiping down the rowNumbers.

Defaults to:

true

getRows : Boolean

Returns the value of rows

Returns

Boolean

setRows (rows)

Sets the value of rows

Parameters

rows :  Boolean

selectedRecord : Ext.data.Model
readonly ro private pri

The selected record. This is exported through the owning DataView's bindable selection property.

Defaults to:

undefined

getSelectedRecord : Ext.data.Model

Returns the value of selectedRecord

Returns

Ext.data.Model

setSelectedRecord (selectedRecord)

Sets the value of selectedRecord

Parameters

selectedRecord :  Ext.data.Model

selection
readonly ro private pri

An instance of a subclass of Ext.dataview.selection.Selection which encapsulates the user's selection.

The actual class of this object depends upon configuration, and upon the user gestures used to create the selection.

Provided classes are:

Defaults to:

{
    type: 'records'
}

getSelection ( what, reset ) : Ext.dataview.selection.Selection
private pri

Parameters

what :  "rows"/"records"/"cells"/"columns"

The kind of object is to be selected.

reset :  Boolean

Returns

:Ext.dataview.selection.Selection

A Selection object of the required type.

setSelection (selection)

Sets the value of selection

Parameters

selection :  Object

toggleOnClick : Boolean

true to toggle the selection state of an item when clicked. Only applicable when the mode is 'single'. Only applicable when the deselectable is 'true'.

Defaults to:

true

getToggleOnClick : Boolean

Returns the value of toggleOnClick

Returns

Boolean

setToggleOnClick (toggleOnClick)

Sets the value of toggleOnClick

Parameters

toggleOnClick :  Boolean

properties

Instance Properties

$eventOptions
private pri

Matches options property names within a listeners specification object - property names which are never used as event names.

Defaults to:

{
    scope: 1,
    delay: 1,
    buffer: 1,
    onFrame: 1,
    single: 1,
    args: 1,
    destroyable: 1,
    priority: 1,
    order: 1
}

$vetoClearingPrototypeOnDestroy
private pri

We don't want the base destructor to clear the prototype because our destroyObservable handler must be called the very last. It will take care of the prototype after completing Observable destruction sequence.

Defaults to:

true

autoGenId : Boolean
private pri

true indicates an id was auto-generated rather than provided by configuration.

Defaults to:

false

Available since: 6.7.0

axesConfigs : Object
private pri

Use when converting the extensible config into a SelectionExtender to create its axes config to specify which axes it may extend.

Defaults to:

{
    x: 1,
    y: 2,
    xy: 3,
    both: 3,
    "true": 3
}

eventsSuspended
private pri

Initial suspended call count. Incremented when suspendEvents is called, decremented when resumeEvents is called.

Defaults to:

0

factoryConfig : Object

If this property is specified by the target class of this mixin its properties are used to configure the created Ext.Factory.

hasListeners : Object
readonly ro

This object holds a key for any event that has a listener. The listener may be set directly on the instance, or on its class or a super class (via observe) or on the MVC EventBus. The values of this object are truthy (a non-zero number) and falsy (0 or undefined). They do not represent an exact count of listeners. The value for an event is truthy if the event must be fired and is falsy if there is no need to fire the event.

The intended use of this property is to avoid the expense of fireEvent calls when there are no listeners. This can be particularly helpful when one would otherwise have to call fireEvent hundreds or thousands of times. It is used like this:

 if (this.hasListeners.foo) {
     this.fireEvent('foo', this, arg1);
 }

isObservable : Boolean

true in this class to identify an object as an instantiated Observable, or subclass thereof.

Defaults to:

true

methods

Instance Methods

_addDeclaredListeners ( listeners ) : Boolean
private pri

Adds declarative listeners as nested arrays of listener objects.

Parameters

listeners :  Array

Returns

:Boolean

true if any listeners were added

addListener ( eventName, [fn], [scope], [options], [order] ) : Object
chainable ch

The on method is shorthand for addListener.

Appends an event handler to this object. For example:

myGridPanel.on("itemclick", this.onItemClick, this);

The method also allows for a single argument to be passed which is a config object containing properties which specify multiple events. For example:

myGridPanel.on({
    cellclick: this.onCellClick,
    select: this.onSelect,
    viewready: this.onViewReady,
    scope: this // Important. Ensure "this" is correct during handler execution
});

One can also specify options for each event handler separately:

myGridPanel.on({
    cellclick: {fn: this.onCellClick, scope: this, single: true},
    viewready: {fn: panel.onViewReady, scope: panel}
});

Names of methods in a specified scope may also be used:

myGridPanel.on({
    cellclick: {fn: 'onCellClick', scope: this, single: true},
    viewready: {fn: 'onViewReady', scope: panel}
});

Parameters

eventName :  String/Object

The name of the event to listen for. May also be an object who's property names are event names.

fn :  Function/String (optional)

The method the event invokes or the name of the method within the specified scope. Will be called with arguments given to Ext.util.Observable#fireEvent plus the options parameter described below.

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.

Note: The options object will also be passed as the last argument to every event handler.

This object 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.

onFrame :  Number

Causes the handler to be scheduled to run at the next animation frame event. If the event fires again before that time, the handler is not rescheduled - the handler will only be called once when the next animation frame is fired, with the last set of arguments passed.

target :  Ext.util.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.

element :  String

This option is only valid for listeners bound to Ext.Component. The name of a Component property which references an Ext.dom.Element to add a listener to.

This option is useful during Component construction to add DOM event listeners to elements of Ext.Component which will exist only after the Component is rendered.

For example, to add a click listener to a Panel's body:

  var panel = new Ext.panel.Panel({
      title: 'The title',
      listeners: {
          click: this.handlePanelClick,
          element: 'body'
      }
  });

In order to remove listeners attached using the element, you'll need to reference the element itself as seen below.

 panel.body.un(...)

delegate :  String (optional)

A simple selector to filter the event target or look for a descendant of the target.

The "delegate" option is only available on Ext.dom.Element instances (or when attaching a listener to a Ext.dom.Element via a Component using the element option).

See the delegate example below.

capture :  Boolean (optional)

When set to true, the listener is fired in the capture phase of the event propagation sequence, instead of the default bubble phase.

The capture option is only available on Ext.dom.Element instances (or when attaching a listener to a Ext.dom.Element via a Component using the element option).

stopPropagation :  Boolean (optional)

This option is only valid for listeners bound to Ext.dom.Element. true to call stopPropagation on the event object before firing the handler.

preventDefault :  Boolean (optional)

This option is only valid for listeners bound to Ext.dom.Element. true to call preventDefault on the event object before firing the handler.

stopEvent :  Boolean (optional)

This option is only valid for listeners bound to Ext.dom.Element. true to call stopEvent on the event object before firing the handler.

args :  Array (optional)

Optional set of arguments to pass to the handler function before the actual fired event arguments. For example, if args is set to ['foo', 42], the event handler function will be called with an arguments list like this:

 handler('foo', 42, <actual event arguments>...);

destroyable :  Boolean (optional)

When specified as true, the function returns a destroyable object. An object which implements the destroy method which removes all listeners added in this call. This syntax can be a helpful shortcut to using un; particularly when removing multiple listeners. NOTE - not compatible when using the element option. See un for the proper syntax for removing listeners added using the element config.

Defaults to:

false

priority :  Number (optional)

An optional numeric priority that determines the order in which event handlers are run. Event handlers with no priority will be run as if they had a priority of 0. Handlers with a higher priority will be prioritized to run sooner than those with a lower priority. Negative numbers can be used to set a priority lower than the default. Internally, the framework uses a range of 1000 or greater, and -1000 or lesser for handlers that are intended to run before or after all others, so it is recommended to stay within the range of -999 to 999 when setting the priority of event handlers in application-level code. A priority must be an integer to be valid. Fractional values are reserved for internal framework use.

order :  String (optional)

A legacy option that is provided for backward compatibility. It is recommended to use the priority option instead. Available options are:

  • 'before': equal to a priority of 100
  • 'current': equal to a priority of 0 or default priority
  • 'after': equal to a priority of -100

Defaults to:

'current'

order :  String (optional)

A shortcut for the order event option. Provided for backward compatibility. Please use the priority event option instead.

Defaults to: 'current'

Returns

:Object

Only when the destroyable option is specified.

A Destroyable object. An object which implements the destroy method which removes all listeners added in this call. For example:

this.btnListeners =  = myButton.on({
    destroyable: true
    mouseover:   function() { console.log('mouseover'); },
    mouseout:    function() { console.log('mouseout'); },
    click:       function() { console.log('click'); }
});

And when those listeners need to be removed:

Ext.destroy(this.btnListeners);

or

this.btnListeners.destroy();

addManagedListener ( item, ename, [fn], [scope], [options] ) : Object

The addManagedListener method is used when some object (call it "A") is listening to an event on another observable object ("B") and you want to remove that listener from "B" when "A" is destroyed. This is not an issue when "B" is destroyed because all of its listeners will be removed at that time.

Example:

Ext.define('Foo', {
    extend: 'Ext.Component',

    initComponent: function () {
        this.addManagedListener(MyApp.SomeSharedMenu, 'show', this.doSomething);
        this.callParent();
    }
});

As you can see, when an instance of Foo is destroyed, it ensures that the 'show' listener on the menu (MyApp.SomeGlobalSharedMenu) is also removed.

As of version 5.1 it is no longer necessary to use this method in most cases because listeners are automatically managed if the scope object provided to addListener is an Observable instance. However, if the observable instance and scope are not the same object you still need to use mon or addManagedListener if you want the listener to be managed.

Parameters

item :  Ext.util.Observable/Ext.dom.Element

The item to which to add a listener/listeners.

ename :  Object/String

The event name, or an object containing event name properties.

fn :  Function/String (optional)

If the ename parameter was an event name, this is the handler function or the name of a method on the specified scope.

scope :  Object (optional)

If the ename parameter was an event name, this is the scope (this reference) in which the handler function is executed.

options :  Object (optional)

If the ename parameter was an event name, this is the addListener options.

Returns

:Object

Only when the destroyable option is specified.

A Destroyable object. An object which implements the destroy method which removes all listeners added in this call. For example:

this.btnListeners = myButton.mon({
    destroyable: true
    mouseover:   function() { console.log('mouseover'); },
    mouseout:    function() { console.log('mouseout'); },
    click:       function() { console.log('click'); }
});

And when those listeners need to be removed:

Ext.destroy(this.btnListeners);

or

this.btnListeners.destroy();

applyMode ( mode )
private pri

Parameters

mode :  Object

applyStore ( store )
private pri

Parameters

store :  Object

changeSelectionRange ( view, location, e )
private pri

Parameters

view :  Object

location :  Object

e :  Object

clearListeners

Removes all listeners for this object including the managed listeners

clearManagedListeners

Removes all managed listeners for this object.

createCheckboxColumn ( checkboxDefaults )
private pri

Retrieve a configuration to be used in a HeaderContainer. This should be used when checkboxSelect is set to false.

Parameters

checkboxDefaults :  Object

createRelayer ( newName, [beginEnd] ) : Function
private pri

Creates an event handling function which re-fires the event from this object as the passed event name.

Parameters

newName :  String

The name under which to re-fire the passed parameters.

beginEnd :  Array (optional)

The caller can specify on which indices to slice.

Returns

:Function

deselect ( records, suppressEvent )

Deselects the given record(s). If many records are currently selected, it will only deselect those you pass in.

Parameters

records :  Number/Array/Ext.data.Model

The record(s) to deselect. Can also be a number to reference by index.

suppressEvent :  Boolean

If true the deselect event will not be fired.

deselectAll ( [suppressEvent] )

Clears the selection.

Parameters

suppressEvent :  Boolean (optional)

Pass true to prevent firing the selectionchange event.

deselectAll ( [suppressEvent] )

Clears the selection.

Parameters

suppressEvent :  Boolean (optional)

Pass true to prevent firing the selectionchange event.

deselectColumn ( column, [suppressEvent] )

Deselects a column.

Parameters

column :  Ext.grid.column.Column

Column to deselect.

suppressEvent :  Boolean (optional)

Pass true to prevent firing the selectionchange event.

deselectColumn ( column, [suppressEvent] )

Deselects a column.

Parameters

column :  Ext.grid.column.Column

Column to deselect.

suppressEvent :  Boolean (optional)

Pass true to prevent firing the selectionchange event.

destroy
private pri

Destructor for classes that extend Observable.

doFireEvent ( eventName, args, bubbles )
private pri

Continue to fire event.

Parameters

eventName :  String

args :  Array

bubbles :  Boolean

doMultiSelect ( records, keepExisting, suppressEvent )
private pri

Selects a set of multiple records.

Parameters

records :  Object

keepExisting :  Object

suppressEvent :  Object

doSingleSelect ( record, suppressEvent )
private pri

Selects a single record.

Parameters

record :  Object

suppressEvent :  Object

enableBubble ( eventNames )

Enables events fired by this Observable to bubble up an owner hierarchy by calling this.getBubbleTarget() if present. There is no implementation in the Observable base class.

This is commonly used by Ext.Components to bubble events to owner Containers. See Ext.Component#getBubbleTarget. The default implementation in Ext.Component returns the Component's immediate owner. But if a known target is required, this can be overridden to access the required target more quickly.

Example:

Ext.define('Ext.overrides.form.field.Base', {
    override: 'Ext.form.field.Base',

    //  Add functionality to Field's initComponent to enable
    // the change event to bubble
    initComponent: function () {
        this.callParent();
        this.enableBubble('change');
    }
});

var myForm = Ext.create('Ext.form.Panel', {
    title: 'User Details',
    items: [{
        ...
    }],
    listeners: {
        change: function() {
            // Title goes red if form has been modified.
            myForm.header.setStyle('color', 'red');
        }
    }
});

Parameters

eventNames :  String/String[]

The event name to bubble, or an Array of event names.

extendSelection ( extension )
private pri

Called when the SelectionExtender has the mouse released.

Parameters

extension :  Object

An object describing the type and size of extension.

type :  String

"rows" or "columns"

start :  Ext.grid.Location

The start (top left) cell of the extension area.

end :  Ext.grid.Location

The end (bottom right) cell of the extension area.

columns :  Number (optional)

The number of columns extended (-ve means on the left side).

rows :  Number (optional)

The number of rows extended (-ve means on the top side).

fireAction ( eventName, args, fn, [scope], [options], [order] )
deprecated dep

Fires the specified event with the passed parameters and executes a function (action). By default, the action function will be executed after any "before" event handlers (as specified using the order option of addListener), but before any other handlers are fired. This gives the "before" handlers an opportunity to cancel the event by returning false, and prevent the action function from being called.

The action can also be configured to run after normal handlers, but before any "after" handlers (as specified using the order event option) by passing 'after' as the order parameter. This configuration gives any event handlers except for "after" handlers the opportunity to cancel the event and prevent the action function from being called.

Parameters

eventName :  String

The name of the event to fire.

args :  Array

Arguments to pass to handlers and to the action function.

fn :  Function

The action function.

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)

Event options for the action function. Accepts any of the options of addListener

order :  String (optional)

The order to call the action function relative too the event handlers ('before' or 'after'). Note that this option is simply used to sort the action function relative to the event handlers by "priority". An order of 'before' is equivalent to a priority of 99.5, while an order of 'after' is equivalent to a priority of -99.5. See the priority option of addListener for more details.

Defaults to: 'before'

Deprecated since version 5.5
Use fireEventedAction instead.

fireEvent ( eventName, args ) : Boolean

Fires the specified event with the passed parameters (minus the event name, plus the options object passed to addListener).

An event may be set to bubble up an Observable parent hierarchy (See Ext.Component#getBubbleTarget) by calling enableBubble.

Parameters

eventName :  String

The name of the event to fire.

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.

fireEventArgs ( eventName, args ) : Boolean

Fires the specified event with the passed parameter list.

An event may be set to bubble up an Observable parent hierarchy (See Ext.Component#getBubbleTarget) by calling enableBubble.

Parameters

eventName :  String

The name of the event to fire.

args :  Object[]

An array of parameters which are passed to handlers.

Returns

:Boolean

returns false if any of the handlers return false otherwise it returns true.

fireEventedAction ( eventName, args, fn, [scope], [fnArgs] ) : Boolean

Fires the specified event with the passed parameters and executes a function (action). Evented Actions will automatically dispatch a 'before' event passing. This event will be given a special controller that allows for pausing/resuming of the event flow.

By pausing the controller the updater and events will not run until resumed. Pausing, however, will not stop the processing of any other before events.

Parameters

eventName :  String

The name of the event to fire.

args :  Array

Arguments to pass to handlers and to the action function.

fn :  Function/String

The action function.

scope :  Object (optional)

The scope (this reference) in which the handler function is executed. If omitted, defaults to the object which fired the event.

fnArgs :  Array/Boolean (optional)

Optional arguments for the action fn. If not given, the normal args will be used to call fn. If false is passed, the args are used but if the first argument is this instance it will be removed from the args passed to the action function.

Returns

:Boolean

fireSelectionChange ( records, selecting )
private pri

Parameters

records :  Ext.data.Model[]

ONLY passed if called from the base class's onCollectionAdd/Remove observers on the record collection.

selecting :  Boolean

ONLY passed if called from the base class's onCollectionAdd/Remove observers on the record collection.

getBubbleParent Ext.util.Observable
private pri

Gets the bubbling parent for an Observable

Returns

:Ext.util.Observable

The bubble parent. null is returned if no bubble target exists

getId String

Retrieves the id. This method Will auto-generate an id if one has not already been configured.

Returns

:String

id

getSelectedRecords Ext.data.Model[]

Returns the selected records only if this selection model is configured to select records as opposed to record indices.

Returns

:Ext.data.Model[]

The selected records.

getSelectionCount Number

Returns the number of selections.

Returns

:Number

getSelections Ext.data.Model[]

Returns the currently selected records if this selection model is selecting records..

Returns

:Ext.data.Model[]

The selected records.

getViewListeners Object
private pri

Returns

:Object

hasListener ( eventName ) : Boolean

Checks to see if this object has any listeners for a specified event, or whether the event bubbles. The answer indicates whether the event needs firing or not.

Parameters

eventName :  String

The name of the event to check for

Returns

:Boolean

true if the event is being listened for or bubbles, else false

hasSelection Boolean

Returns true if there is a selected record.

Returns

:Boolean

isCellSelected ( row, column ) : Boolean
private pri

Returns true if specified cell within specified view is selected

Used in Ext.grid.Row rendering to decide upon cell UI treatment.

Parameters

row :  Number/Ext.grid.Location/Ext.data.Model

The Row index/record or Ext.grid.Location to test.

column :  Number

Column index to test.

Returns

:Boolean

isColumnSelected ( column ) : Boolean
private pri

Check if given column is currently selected.

Parameters

column :  Ext.grid.column.Column

Returns

:Boolean

isRowSelected ( record ) : Boolean

Returns true if the specified row is selected.

Parameters

record :  Ext.data.Model/Number

The record or index of the record to check.

Returns

:Boolean

isSelected ( record ) : Boolean
deprecated dep

Returns true if the specified row is selected.

Parameters

record :  Ext.data.Model/Number

The record or index of the record to check.

Returns

:Boolean

Deprecated since version 6.5.0
Use isRowSelected to interrogate row/record selection.

isSuspended ( [event] ) : Boolean

Checks if all events, or a specific event, is suspended.

Parameters

event :  String (optional)

The name of the specific event to check

Returns

:Boolean

true if events are suspended

mon ( item, ename, [fn], [scope], [options] ) : Object

Shorthand for addManagedListener. The addManagedListener method is used when some object (call it "A") is listening to an event on another observable object ("B") and you want to remove that listener from "B" when "A" is destroyed. This is not an issue when "B" is destroyed because all of its listeners will be removed at that time.

Example:

Ext.define('Foo', {
    extend: 'Ext.Component',

    initComponent: function () {
        this.addManagedListener(MyApp.SomeGlobalSharedMenu, 'show', this.doSomething);
        this.callParent();
    }
});

As you can see, when an instance of Foo is destroyed, it ensures that the 'show' listener on the menu (MyApp.SomeGlobalSharedMenu) is also removed.

As of version 5.1 it is no longer necessary to use this method in most cases because listeners are automatically managed if the scope object provided to addListener is an Observable instance. However, if the observable instance and scope are not the same object you still need to use mon or addManagedListener if you want the listener to be managed.

Parameters

item :  Ext.util.Observable/Ext.dom.Element

The item to which to add a listener/listeners.

ename :  Object/String

The event name, or an object containing event name properties.

fn :  Function/String (optional)

If the ename parameter was an event name, this is the handler function or the name of a method on the specified scope.

scope :  Object (optional)

If the ename parameter was an event name, this is the scope (this reference) in which the handler function is executed.

options :  Object (optional)

If the ename parameter was an event name, this is the addListener options.

Returns

:Object

Only when the destroyable option is specified.

A Destroyable object. An object which implements the destroy method which removes all listeners added in this call. For example:

this.btnListeners = myButton.mon({
    destroyable: true
     mouseover:   function() { console.log('mouseover'); },
    mouseout:    function() { console.log('mouseout'); },
    click:       function() { console.log('click'); }
});

And when those listeners need to be removed:

Ext.destroy(this.btnListeners);

or

this.btnListeners.destroy();

mun ( item, ename, [fn], [scope] )

Shorthand for removeManagedListener. Removes listeners that were added by the mon method.

Parameters

item :  Ext.util.Observable/Ext.dom.Element

The item from which to remove a listener/listeners.

ename :  Object/String

The event name, or an object containing event name properties.

fn :  Function (optional)

If the ename parameter was an event name, this is the handler function.

scope :  Object (optional)

If the ename parameter was an event name, this is the scope (this reference) in which the handler function is executed.

on ( eventName, [fn], [scope], [options], [order] ) : Object

The on method is shorthand for addListener.

Appends an event handler to this object. For example:

myGridPanel.on("itemclick", this.onItemClick, this);

The method also allows for a single argument to be passed which is a config object containing properties which specify multiple events. For example:

myGridPanel.on({
    cellclick: this.onCellClick,
    select: this.onSelect,
    viewready: this.onViewReady,
    scope: this // Important. Ensure "this" is correct during handler execution
});

One can also specify options for each event handler separately:

myGridPanel.on({
    cellclick: {fn: this.onCellClick, scope: this, single: true},
    viewready: {fn: panel.onViewReady, scope: panel}
});

Names of methods in a specified scope may also be used:

myGridPanel.on({
    cellclick: {fn: 'onCellClick', scope: this, single: true},
    viewready: {fn: 'onViewReady', scope: panel}
});

Parameters

eventName :  String/Object

The name of the event to listen for. May also be an object who's property names are event names.

fn :  Function/String (optional)

The method the event invokes or the name of the method within the specified scope. Will be called with arguments given to Ext.util.Observable#fireEvent plus the options parameter described below.

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.

Note: The options object will also be passed as the last argument to every event handler.

This object 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.

onFrame :  Number

Causes the handler to be scheduled to run at the next animation frame event. If the event fires again before that time, the handler is not rescheduled - the handler will only be called once when the next animation frame is fired, with the last set of arguments passed.

target :  Ext.util.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.

element :  String

This option is only valid for listeners bound to Ext.Component. The name of a Component property which references an Ext.dom.Element to add a listener to.

This option is useful during Component construction to add DOM event listeners to elements of Ext.Component which will exist only after the Component is rendered.

For example, to add a click listener to a Panel's body:

  var panel = new Ext.panel.Panel({
      title: 'The title',
      listeners: {
          click: this.handlePanelClick,
          element: 'body'
      }
  });

In order to remove listeners attached using the element, you'll need to reference the element itself as seen below.

 panel.body.un(...)

delegate :  String (optional)

A simple selector to filter the event target or look for a descendant of the target.

The "delegate" option is only available on Ext.dom.Element instances (or when attaching a listener to a Ext.dom.Element via a Component using the element option).

See the delegate example below.

capture :  Boolean (optional)

When set to true, the listener is fired in the capture phase of the event propagation sequence, instead of the default bubble phase.

The capture option is only available on Ext.dom.Element instances (or when attaching a listener to a Ext.dom.Element via a Component using the element option).

stopPropagation :  Boolean (optional)

This option is only valid for listeners bound to Ext.dom.Element. true to call stopPropagation on the event object before firing the handler.

preventDefault :  Boolean (optional)

This option is only valid for listeners bound to Ext.dom.Element. true to call preventDefault on the event object before firing the handler.

stopEvent :  Boolean (optional)

This option is only valid for listeners bound to Ext.dom.Element. true to call stopEvent on the event object before firing the handler.

args :  Array (optional)

Optional arguments to pass to the handler function. Any additional arguments passed to fireEvent will be appended to these arguments.

destroyable :  Boolean (optional)

When specified as true, the function returns a destroyable object. An object which implements the destroy method which removes all listeners added in this call. This syntax can be a helpful shortcut to using un; particularly when removing multiple listeners. NOTE - not compatible when using the element option. See un for the proper syntax for removing listeners added using the element config.

Defaults to:

false

priority :  Number (optional)

An optional numeric priority that determines the order in which event handlers are run. Event handlers with no priority will be run as if they had a priority of 0. Handlers with a higher priority will be prioritized to run sooner than those with a lower priority. Negative numbers can be used to set a priority lower than the default. Internally, the framework uses a range of 1000 or greater, and -1000 or lesser for handlers that are intended to run before or after all others, so it is recommended to stay within the range of -999 to 999 when setting the priority of event handlers in application-level code. A priority must be an integer to be valid. Fractional values are reserved for internal framework use.

order :  String (optional)

A legacy option that is provided for backward compatibility. It is recommended to use the priority option instead. Available options are:

  • 'before': equal to a priority of 100
  • 'current': equal to a priority of 0 or default priority
  • 'after': equal to a priority of -100

Defaults to:

'current'

order :  String (optional)

A shortcut for the order event option. Provided for backward compatibility. Please use the priority event option instead.

Combining Options

Using the options argument, it is possible to combine different types of listeners:

A delayed, one-time listener.

myPanel.on('hide', this.handleClick, 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 and handler configs.

grid.on({
    itemclick: 'onItemClick',
    itemcontextmenu: grid.onItemContextmenu,
    destroy: {
        fn: function () {
            // function called within the 'altCmp' scope instead of grid
        },
        scope: altCmp // unique scope for the destroy handler
    },
    scope: grid       // default scope - provided for example clarity
});

Delegate

This is a configuration option that you can pass along when registering a handler for an event to assist with event delegation. By setting this configuration option to a simple selector, the target element will be filtered to look for a descendant of the target. For example:

var panel = Ext.create({
    xtype: 'panel',
    renderTo: document.body,
    title: 'Delegate Handler Example',
    frame: true,
    height: 220,
    width: 220,
    html: '<h1 class="myTitle">BODY TITLE</h1>Body content'
});

// The click handler will only be called when the click occurs on the
// delegate: h1.myTitle ("h1" tag with class "myTitle")
panel.on({
    click: function (e) {
        console.log(e.getTarget().innerHTML);
    },
    element: 'body',
    delegate: 'h1.myTitle'
 });

Defaults to: 'current'

Returns

:Object

Only when the destroyable option is specified.

A Destroyable object. An object which implements the destroy method which removes all listeners added in this call. For example:

this.btnListeners =  = myButton.on({
    destroyable: true
    mouseover:   function() { console.log('mouseover'); },
    mouseout:    function() { console.log('mouseout'); },
    click:       function() { console.log('click'); }
});

And when those listeners need to be removed:

Ext.destroy(this.btnListeners);

or

this.btnListeners.destroy();

onAfter ( eventName, fn, [scope], [options] )

Appends an after-event handler.

Same as addListener with order set to 'after'.

Parameters

eventName :  String/String[]/Object

The name of the event to listen for.

fn :  Function/String

The method the event invokes.

scope :  Object (optional)

The scope for fn.

options :  Object (optional)

An object containing handler configuration.

onBefore ( eventName, fn, [scope], [options] )

Appends a before-event handler. Returning false from the handler will stop the event.

Same as addListener with order set to 'before'.

Parameters

eventName :  String/String[]/Object

The name of the event to listen for.

fn :  Function/String

The method the event invokes.

scope :  Object (optional)

The scope for fn.

options :  Object (optional)

An object containing handler configuration.

onCollectionAdd ( selectedCollection, adds )
private pri

Respond to selection. Call the onItemSelect template method

Parameters

selectedCollection :  Object

adds :  Object

onCollectionRemove ( selectedCollection, chunk )
private pri

Respond to deselection. Call the onItemDeselect template method

Parameters

selectedCollection :  Object

chunk :  Object

onColumnUpdate ( headerCt, columns )
private pri

Intercepts the grid's updateColumns method. Adds the checkbox header.

Parameters

headerCt :  Object

columns :  Object[]

onHeaderTap ( headerCt, header, e )
private pri

Parameters

headerCt :  Object

header :  Object

e :  Object

onIdChanged ( store, rec, oldId, newId )
private pri

Parameters

store :  Object

rec :  Object

oldId :  Object

newId :  Object

onNavigate ( navigateEvent )
private pri

Called when the grid's Navigation model detects navigation events (mousedown, click and certain keydown events).

Parameters

navigateEvent :  Ext.event.Event

The event which caused navigation.

onSelectionFinish ( sel, [firstCell], [lastCell] )
private pri

Called when a selection has been made. The selection object's onSelectionFinish calls back into this.

Parameters

sel :  Ext.dataview.selection.Selection

The selection object specific to the selection performed.

firstCell :  Ext.grid.Location (optional)

The left/top most selected cell. Will be undefined if the selection is clear.

lastCell :  Ext.grid.Location (optional)

The bottom/right most selected cell. Will be undefined if the selection is clear.

onViewCreated ( view )
private pri

Called after the view has completed its initialization.

Parameters

view :  Object

onViewDragEnd ( e )
private pri

Clean up mousemove event

Parameters

e :  Object

onViewDragStart ( e ) : Boolean
private pri

Plumbing for drag selection of cell range

Parameters

e :  Object

Returns

:Boolean

onViewSelectionDrag ( e )
private pri

Selects range based on mouse movements

Parameters

e :  Object

relayEvents ( origin, events, [prefix] ) : Object

Relays selected events from the specified Observable as if the events were fired by this.

For example if you are extending Grid, you might decide to forward some events from store. So you can do this inside your initComponent:

this.relayEvents(this.getStore(), ['load']);

The grid instance will then have an observable 'load' event which will be passed the parameters of the store's load event and any function fired with the grid's load event would have access to the grid using the this keyword (unless the event is handled by a controller's control/listen event listener in which case 'this' will be the controller rather than the grid).

Parameters

origin :  Object

The Observable whose events this object is to relay.

events :  String[]/Object

Array of event names to relay or an Object with key/value pairs translating to ActualEventName/NewEventName respectively. For example: this.relayEvents(this, {add:'push', remove:'pop'});

Would now redispatch the add event of this as a push event and the remove event as a pop event.

prefix :  String (optional)

A common prefix to prepend to the event names. For example:

this.relayEvents(this.getStore(), ['load', 'clear'], 'store');

Now the grid will forward 'load' and 'clear' events of store as 'storeload' and 'storeclear'.

Returns

:Object

A Destroyable object. An object which implements the destroy method which, when destroyed, removes all relayers. For example:

this.storeRelayers = this.relayEvents(this.getStore(), ['load', 'clear'], 'store');

Can be undone by calling

Ext.destroy(this.storeRelayers);

or this.store.relayers.destroy();

removeListener ( eventName, fn, [scope] ) :
chainable ch

Removes an event handler.

Parameters

eventName :  String

The type of event the handler was associated with.

fn :  Function

The handler to remove. This must be a reference to the function passed into the addListener call.

scope :  Object (optional)

The scope originally specified for the handler. It must be the same as the scope argument specified in the original call to Ext.util.Observable#addListener or the listener will not be removed.

Returns

:

removeManagedListener ( item, ename, [fn], [scope] )

Removes listeners that were added by the mon method.

Parameters

item :  Ext.util.Observable/Ext.dom.Element

The item from which to remove a listener/listeners.

ename :  Object/String

The event name, or an object containing event name properties.

fn :  Function (optional)

If the ename parameter was an event name, this is the handler function.

scope :  Object (optional)

If the ename parameter was an event name, this is the scope (this reference) in which the handler function is executed.

removeManagedListenerItem ( isClear, managedListener, item, ename, fn, scope )
private pri

Remove a single managed listener item

Parameters

isClear :  Boolean

True if this is being called during a clear

managedListener :  Object

The managed listener item

item :  Object

ename :  String

fn :  Function

scope :  Object

See removeManagedListener for other args

resetSelection ( suppressEvent )
private pri

Parameters

suppressEvent :  Object

resolveListenerScope ( [defaultScope] ) : Object
protected pro

Gets the default scope for firing late bound events (string names with no scope attached) at runtime.

Parameters

defaultScope :  Object (optional)

The default scope to return if none is found.

Defaults to: this

Returns

:Object

The default event scope

resumeEvent ( eventName )

Resumes firing of the named event(s).

After calling this method to resume events, the events will fire when requested to fire.

Note that if the suspendEvent method is called multiple times for a certain event, this converse method will have to be called the same number of times for it to resume firing.

Parameters

eventName :  String...

Multiple event names to resume.

resumeEvents ( [discardQueue] )

Resumes firing events (see suspendEvents).

If events were suspended using the queueSuspended parameter, then all events fired during event suspension will be sent to any listeners now.

Parameters

discardQueue :  Boolean (optional)

true to prevent any previously queued events from firing while we were suspended. See suspendEvents.

scrollTowardsPointer ( e, view )
private pri

When dragging selection outside of the grid, this method will scroll the view towards the pointer.

Parameters

e :  Object

view :  Object

select ( records, [keepExisting], [suppressEvent] )

Adds the given records to the currently selected set if not disabled.

Parameters

records :  Ext.data.Model/Array/Number

The records to select.

keepExisting :  Boolean (optional)

If true, the existing selection will be added to (if not, the old selection is replaced).

suppressEvent :  Boolean (optional)

If true, the select event will not be fired.

selectAll ( [suppressEvent] )

Select all the data if possible.

If rows is true, then all records will be selected.

If cells is true, then all rendered cells will be selected.

If columns is true, then all columns will be selected.

Parameters

suppressEvent :  Boolean (optional)

Pass true to prevent firing the selectionchange event.

selectAll ( [suppressEvent] )

Select all the data if possible.

If rows is true, then all records will be selected.

If cells is true, then all rendered cells will be selected.

If columns is true, then all columns will be selected.

Parameters

suppressEvent :  Boolean (optional)

Pass true to prevent firing the selectionchange event.

selectCells ( rangeStart, rangeEnd, [suppressEvent] )

This method allows programmatic selection of the cell range.

Parameters

rangeStart :  Ext.grid.Location/Number[]

Range starting position. Can be either Cell context or a [rowIndex, columnIndex] numeric array.

Note that when a numeric array is used in a locking grid, the column indices are relative to the outermost grid, encompassing locked and normal sides.

rangeEnd :  Ext.grid.Location/Number[]

Range end position. Can be either Cell context or a [rowIndex, columnIndex] numeric array.

Note that when a numeric array is used in a locking grid, the column indices are relative to the outermost grid, encompassing locked and normal sides.

suppressEvent :  Boolean (optional)

Pass true to not fire the selectionchange event.

selectCells ( rangeStart, rangeEnd, [suppressEvent] )

This method allows programmatic selection of the cell range.

Parameters

rangeStart :  Ext.grid.Location/Number[]

Range starting position. Can be either Cell context or a [rowIndex, columnIndex] numeric array.

Note that when a numeric array is used in a locking grid, the column indices are relative to the outermost grid, encompassing locked and normal sides.

rangeEnd :  Ext.grid.Location/Number[]

Range end position. Can be either Cell context or a [rowIndex, columnIndex] numeric array.

Note that when a numeric array is used in a locking grid, the column indices are relative to the outermost grid, encompassing locked and normal sides.

suppressEvent :  Boolean (optional)

Pass true to prevent firing the selectionchange event.

selectColumn ( column, [keepSelection], [suppressEvent] )

Selects a column.

Parameters

column :  Ext.grid.column.Column

Column to select.

keepSelection :  Boolean (optional)

Pass true to keep previous selection.

Defaults to: false

suppressEvent :  Boolean (optional)

Pass true to prevent firing the selectionchange event.

selectColumn ( column, [keepSelection], [suppressEvent] )

Selects a column.

Parameters

column :  Ext.grid.column.Column

Column to select.

keepSelection :  Boolean (optional)

Pass true to keep previous selection.

Defaults to: false

suppressEvent :  Boolean (optional)

Pass true to prevent firing the selectionchange event.

selectRange ( startRecord, endRecord, [keepExisting] )

Selects a range of rows if the selection model if not disabled. All rows in between startRecord and endRecord are also selected.

Parameters

startRecord :  Number

The index of the first row in the range.

endRecord :  Number

The index of the last row in the range.

keepExisting :  Boolean (optional)

true to retain existing selections.

selectRows ( rows, [keepSelection], [suppressEvent] )

Select one or more rows.

Parameters

rows :  Ext.data.Model[]

Records to select.

keepSelection :  Boolean (optional)

Pass true to keep previous selection.

Defaults to: false

suppressEvent :  Boolean (optional)

Pass true to prevent firing the selectionchange event.

selectRows ( rows, [keepSelection], [suppressEvent] )

Select one or more rows.

Parameters

rows :  Ext.data.Model[]

Records to select.

keepSelection :  Boolean (optional)

Pass true to keep previous selection.

Defaults to: false

suppressEvent :  Boolean (optional)

Pass true to prevent firing the selectionchange event.

suspendEvent ( eventName )

Suspends firing of the named event(s).

After calling this method to suspend events, the events will no longer fire when requested to fire.

Note that if this is called multiple times for a certain event, the converse method resumeEvent will have to be called the same number of times for it to resume firing.

Parameters

eventName :  String...

Multiple event names to suspend.

suspendEvents ( queueSuspended )

Suspends the firing of all events. (see resumeEvents)

Parameters

queueSuspended :  Boolean

true to queue up suspended events to be fired after the resumeEvents call instead of discarding all suspended events.

toggleAll ( header, e )
private pri

Parameters

header :  Object

e :  Object

un ( eventName, fn, [scope] )

Shorthand for removeListener. Removes an event handler.

Parameters

eventName :  String

The type of event the handler was associated with.

fn :  Function

The handler to remove. This must be a reference to the function passed into the addListener call.

scope :  Object (optional)

The scope originally specified for the handler. It must be the same as the scope argument specified in the original call to Ext.util.Observable#addListener or the listener will not be removed.

Convenience Syntax

You can use the addListener destroyable: true config option in place of calling un(). For example:

var listeners = cmp.on({
    scope: cmp,
    afterrender: cmp.onAfterrender,
    beforehide: cmp.onBeforeHide,
    destroyable: true
});

// Remove listeners
listeners.destroy();
// or
cmp.un(
    scope: cmp,
    afterrender: cmp.onAfterrender,
    beforehide: cmp.onBeforeHide
);

Exception - DOM event handlers using the element config option

You must go directly through the element to detach an event handler attached using the addListener element option.

panel.on({
    element: 'body',
    click: 'onBodyCLick'
});

panel.body.un({
    click: 'onBodyCLick'
});

unAfter ( eventName, fn, [scope], [options] )

Removes a before-event handler.

Same as removeListener with order set to 'after'.

Parameters

eventName :  String/String[]/Object

The name of the event the handler was associated with.

fn :  Function/String

The handler to remove.

scope :  Object (optional)

The scope originally specified for fn.

options :  Object (optional)

Extra options object.

unBefore ( eventName, fn, [scope], [options] )

Removes a before-event handler.

Same as removeListener with order set to 'before'.

Parameters

eventName :  String/String[]/Object

The name of the event the handler was associated with.

fn :  Function/String

The handler to remove.

scope :  Object (optional)

The scope originally specified for fn.

options :  Object (optional)

Extra options object.

updateCells ( cells )
private pri

Parameters

cells :  Object

updateColumns ( columns )
private pri

Enable/disable the HeaderContainer's sortOnClick in line with column select on column click.

Parameters

columns :  Object

updateRows ( rows )
private pri

Show/hide the extra column headers depending upon rowSelection.

Parameters

rows :  Object

updateSelection ( selection, oldSelection )
private pri

Parameters

selection :  Object

oldSelection :  Object

updateView ( view, oldView )
private pri

Parameters

view :  Object

oldView :  Object

Static Methods

override ( members ) : Ext.Base
static sta

Override members of this class. Overridden methods can be invoked via Ext.Base#callParent.

Ext.define('My.Cat', {
    constructor: function() {
        alert("I'm a cat!");
    }
});

My.Cat.override({
    constructor: function() {
        alert("I'm going to be a cat!");

        this.callParent(arguments);

        alert("Meeeeoooowwww");
    }
});

var kitty = new My.Cat(); // alerts "I'm going to be a cat!"
                          // alerts "I'm a cat!"
                          // alerts "Meeeeoooowwww"

Direct use of this method should be rare. Use Ext.define instead:

Ext.define('My.CatOverride', {
    override: 'My.Cat',
    constructor: function() {
        alert("I'm going to be a cat!");

        this.callParent(arguments);

        alert("Meeeeoooowwww");
    }
});

The above accomplishes the same result but can be managed by the Ext.Loader which can properly order the override and its target class and the build process can determine whether the override is needed based on the required state of the target class (My.Cat).

Parameters

members :  Object

The properties to add to this class. This should be specified as an object literal containing one or more properties.

Returns

:Ext.Base

this class

events

selectionchange ( grid, selection, eOpts )

Fired by the grid after the selection changes. Return false to veto the selection extension.

Parameters

grid :  Ext.grid.Panel

The grid whose selection has changed.

selection :  Ext.dataview.selection.Selection

A subclass of Ext.dataview.selection.Selection describing the new selection.

eOpts : Object

The options object passed to Ext.util.Observable.addListener.

selectionchange ( grid, selection, eOpts )

Fired by the grid after the selection changes. Return false to veto the selection extension.

Note that the behavior of selectionchange is different in Ext 6.x vs. Ext 5. In Ext 6.x, if rows are being selected, a block of records is passed as the second parameter. In Ext 5, the selection object was passed.

Parameters

grid :  Ext.grid.Panel

The grid whose selection has changed.

selection :  Ext.dataview.selection.Selection

A subclass of Ext.dataview.selection.Selection describing the new selection.

eOpts : Object

The options object passed to Ext.util.Observable.addListener.

ExtReact 6.7.0