Ext.form.RadioManager

Hierarchy

Inherited mixins

Files

NOTE This is a private utility class for internal use by the framework. Don't rely on its existence.

这是一个私有帮助类, 它能够按照名称分组所有的 Ext.form.field.Radio 组件

Defined By

Config options

指定为 true 则表示 addAll 函数将添加函数引用到集合中. ...

指定为 true 则表示 addAll 函数将添加函数引用到集合中. 默认值: false.

Defaults to: false

一个配置对象,包含一个或多个事件处理函数,在对象初始化时添加到对象。 它应该是addListener指定的一个有效的监听器配置对象, 一次添加多个事件处理函数。

Ext JS 组建的DOM事件

虽然一些Ext JS组件类输出选定的DOM事件(例如"click"、"mouseover"等), 但是这只能通过添加额外的值(如果能)。例如,DataViewitemclick传递被单击的节点。为了通过Component的子元素直接访问DOM事件, 我们需要指定element选项来标识要 添加DOM监听器的Component属性:

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'); }
        }
    }
});
Defined By

Properties

扩展事件

Defaults to: []

默认的排序方向

Defaults to: "ASC"

用于添加和删除时候递增的变化计数器.

Defaults to: 0

本对象包含任何有监听器的事件的键。监听器可以在实例上直接设置, 或者在其类或者父类(通过observe) 或者在MVC EventBus上设置。本对象的值为真 (一个非零的数字)和假(0或者undefined)。它们并不代表确切的监听...

本对象包含任何有监听器的事件的键。监听器可以在实例上直接设置, 或者在其类或者父类(通过observe) 或者在MVC EventBus上设置。本对象的值为真 (一个非零的数字)和假(0或者undefined)。它们并不代表确切的监听器数量。 如果事件必须被触发,它的值是真的, 如果没有必要,就是假的。

本属性的设计目的是避免没有监听器时调用fireEvent的开销。 如果fireEvent要调用成百上千次,这尤其有用。 用法:

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

在此类对象中, 如果是true ,标识一个对象是 MixedCollection 的实例,还是他的子类的实例.

Defaults to: true

在本类中设置为true将一个对象标识为实例化的Observable或其子类。

Defaults to: true

设置为true将某个对象标识为实例化的Sortable或其子类。

Defaults to: true

本身 获取当前类的引用,此对象被实例化。不同于 statics, this.self是依赖范围,它意味着要使用动态继承。 ...

本身

获取当前类的引用,此对象被实例化。不同于 statics, this.self是依赖范围,它意味着要使用动态继承。 参见 statics 详细对比

Ext.define('My.Cat', {
    statics: {
        speciesName: 'Cat' // My.Cat.speciesName = 'Cat'
    },

    constructor: function() {
        alert(this.self.speciesName); // 依赖 'this'
    },

    clone: function() {
        return new this.self();
    }
});


Ext.define('My.SnowLeopard', {
    extend: 'My.Cat',
    statics: {
        speciesName: 'Snow Leopard'         // My.SnowLeopard.speciesName = 'Snow Leopard'
    }
});

var cat = new My.Cat();                     // alerts 'Cat' 猫
var snowLeopard = new My.SnowLeopard();     // alerts 'Snow Leopard' 雪豹

var clone = snowLeopard.clone();
alert(Ext.getClassName(clone));             // alerts 'My.SnowLeopard'

每个包含待排序数据的项的属性

每个包含待排序数据的项的属性

应用于当前Store的排序器集合

应用于当前Store的排序器集合

Defined By

Methods

创建MixedCollection对象。

Parameters

  • allowFunctions : Boolean

    如果addAll函数向集合添加函数引用, 指定为true。默认为 false

  • keyFn : Function

    一个函数,它接收一个类型为MixedCollection中的某种类型的项, 并返回该项的键值。它用以查找所有的 没有将键作为明确的参数传递给一个MixedCollection方法的项的键。这个参数 等价于提供了一个getKey方法的实现。

Returns

( String property, [String dir], [Function fn] )private

Performs the actual sorting based on a direction and a sorting function. Internally, this creates a temporary array of all items in the MixedCollection, sorts it and then writes the sorted array data back into this.items and this.keys

Parameters

  • property : String

    Property to sort by ('key', 'value', or 'index')

  • dir : String (optional)

    Direction to sort 'ASC' or 'DESC'. Defaults to 'ASC'.

  • fn : Function (optional)

    Comparison function that defines the sort order. Defaults to sorting by numeric value.

添加一个项目到集合中. 完成以后触发 add 事件.

Parameters

  • key : String

    关联到item的key,或者是新的item(参数个数只有1个).

    如果此集合 MixedCollection 实现了方法 getKey, 或者被存储条目(items) 的 key是名为 id 的属性, 那么集合 (MixedCollection) 能够为新条目自动 生成(derive) key. 此时方法add仅仅解析 key 这个参数(为新item).

  • o : Object

    要添加的 item.

Returns

添加一个数组,或者对象的元素到集合中.

Parameters

  • objs : Object/Array

    An Object containing properties which will be added to the collection, or an Array of values, each of which are added to the collection. Functions references will be added to the collection if allowFunctions has been set to true.

( Object config )private

添加配置

Parameters

向本Observable可能触发的事件列表中添加指定的事件。

Parameters

  • eventNames : Object/String...

    要么是有事件名作为属性,属性值为 true的对象。例如:

    this.addEvents({
        storeloaded: true,
        storecleared: true
    });
    

    要么是作为参数的任意个数的事件名。例如:

    this.addEvents('storeloaded', 'storecleared');
    

Parameters

( String/Object eventName, [Function fn], [Object scope], [Object options] )
向本对象添加一个事件处理函数,例如: myGridPanel.on("mouseover", this.onMouseOver, this); 这个方法也允许传递单个参数,参数为一个 包含指定多个事件的属性的配置对象。例如: ...

向本对象添加一个事件处理函数,例如:

myGridPanel.on("mouseover", this.onMouseOver, this);

这个方法也允许传递单个参数,参数为一个 包含指定多个事件的属性的配置对象。例如:

myGridPanel.on({
    cellClick: this.onCellClick,
    mouseover: this.onMouseOver,
    mouseout: this.onMouseOut,
    scope: this // Important. Ensure "this" is correct during handler execution
});

你也能为每个事件处理函数单独指定选项:

myGridPanel.on({
    cellClick: {fn: this.onCellClick, scope: this, single: true},
    mouseover: {fn: panel.onMouseOver, scope: panel}
});

也能使用在特定作用域的方法。注意 必须指定scope:

myGridPanel.on({
    cellClick: {fn: 'onCellClick', scope: this, single: true},
    mouseover: {fn: 'onMouseOver', scope: panel}
});

Parameters

  • eventName : String/Object

    被监听的事件名。 也可以是属性名字是事件名字的对象。

  • fn : Function (optional)

    事件调用的方法, 或者如果指定了scope,在指定scope的方法名*。 会被调用, 参数为fireEvent的参数加上下述options参数。

  • scope : Object (optional)

    事件处理函数执行的作用域(this应用的上下文) 如果省略, 默认为触发事件的对象。

  • options : Object (optional)

    包含事件处理函数配置的对象。

    注意: 不像ExtJS 3.x, options对象也会作为最后一个参数 传递给每一个事件处理函数。

    这个对象可能包含以下任何一个属性:

    • scope : Object

      事件处理函数执行的作用域(this应用的上下文) 如果省略, 默认为触发事件的对象。

    • delay : Number

      事件触发后,调用事件处理函数延时毫秒数。

    • single : Boolean

      设置为true添加一个事件处理函数,只处理下一次触发的事件, 然后移除这个函数。

    • buffer : Number

      使事件处理函数在Ext.util.DelayedTask中调度运行, 延时指定的毫秒数。如果事件在这段事件再次触发, 原先的事件处理函数再调用, 新的事件处理函数接替。

    • target : Ext.util.Observable

      只有当事件在目标Observable上触发时调用事件处理函数, 如果事件是从Observable的子类起泡的,不会调用事件处理函数

    • element : String

      这个选项只对绑定在Components上的监听器有效。 Component的一个属性名,这个属性引用一个待添加监听器的元素

      这个选项在Component构造过程中向Components的元素添加DOM事件监听器有用。 这些元素只有在Component渲染之后才会存在。 例如, 向Panel的body中添加click监听器:

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

      组合选项

      使用options参数, 可以组合不同类型的监听器:

      一个延时的一次性监听器:

      myPanel.on('hide', this.handleClick, this, {
          single: true,
          delay: 100
      });
      
向任何Observable对象(或者Ext.Element)添加监听器, 当组件被销毁时,监听器自动被移除 ...

向任何Observable对象(或者Ext.Element)添加监听器, 当组件被销毁时,监听器自动被移除

Parameters

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

    添加监听器的目标项。

  • ename : Object/String

    事件名或者包含的事件名属性的对象。

  • fn : Function

    (可选的) 如果ename参数是事件名, 这就是一个事件处理函数。

  • scope : Object

    (可选的) 如果ename参数是事件名, 这就是(this引用的上下文) 事件处理函数执行的作用域。

  • opt : Object

    (可选的)如果ename参数是事件名, 这就是addListener的选项。

( Object name, Object member )private

Parameters

( Object xtype )private

添加 Xtype

Parameters

( Array/Arguments ) : Objectdeprecatedprotected
调用原来的方法,这是以前的override重写 Ext.define('My.Cat', { constructor: function() { alert("I'm a cat!"); } }); ...

调用原来的方法,这是以前的override重写

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.callOverridden();

        alert("Meeeeoooowwww");
    }
});

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

This method has been deprecated since 4.1

版本 使用 callParent 代替.

Parameters

  • : Array/Arguments

    参数的参数,数组或'参数'对象 来自当前方法,例如: this.callOverridden(arguments)

Returns

  • Object

    返回调用重写方法的结果。

( Array/Arguments args ) : Objectprotected

所谓的"parent"方法是指当前的方法。 这是以前的方法派生或重写(参见 Ext.define)。

 Ext.define('My.Base', {
     constructor: function (x) {
         this.x = x;
     },

     statics: {
         method: function (x) {
             return x;
         }
     }
 });

 Ext.define('My.Derived', {
     extend: 'My.Base',

     constructor: function () {
         this.callParent([21]);
     }
 });

 var obj = new My.Derived();

 alert(obj.x);  // alerts 21

这可以用来重写如下:

 Ext.define('My.DerivedOverride', {
     override: 'My.Derived',

     constructor: function (x) {
         this.callParent([x*2]); // 调用原来的My.Derived构造
     }
 });

 var obj = new My.Derived();

 alert(obj.x);  // 现在提示 42

This also works with static methods.

 Ext.define('My.Derived2', {
     extend: 'My.Base',

     statics: {
         method: function (x) {
             return this.callParent([x*2]); // 调用 My.Base.method
         }
     }
 });

 alert(My.Base.method(10);     // alerts 10
 alert(My.Derived2.method(10); // alerts 20

然后,它也可以重写静态方法。

 Ext.define('My.Derived2Override', {
     override: 'My.Derived2',

     statics: {
         method: function (x) {
             return this.callParent([x*2]); // 调用 My.Derived2.method
         }
     }
 });

 alert(My.Derived2.method(10); // 现在提示 40

Parameters

  • args : Array/Arguments

    这个参数, 通过当前方法得到数组或者 arguments 对象, 例如: this.callParent(arguments)

Returns

  • Object

    返回调用父类的方法的结果。

Removes all items from the collection. Fires the clear event when complete.

移除本对象的包括受管理的监听器在内的所有监听器

移除本对象的所有受管理的监听器

Collects unique values of a particular property in this MixedCollection

Parameters

  • property : String

    The property to collect on

  • root : String (optional)

    'root' property to extract the first argument from. This is used mainly when summing fields in records, where the fields are all stored inside the 'data' object

  • allowBlank : Boolean (optional)

    Pass true to allow null, undefined or empty string values

Returns

Returns true if the collection contains the passed Object as an item.

Parameters

  • o : Object

    The Object to look for in the collection.

Returns

  • Boolean

    True if the collection contains the Object as an item.

Returns true if the collection contains the passed Object as a key.

Parameters

  • key : String

    The key to look for in the collection.

Returns

  • Boolean

    True if the collection contains the Object as a key.

( String eventName, Array args, Boolean bubbles )private

Continue to fire event.

Parameters

( Object newName, [Array beginEnd] ) : Functionprivate

Creates an event handling function which refires the event from this object as the passed event name.

Parameters

  • newName : Object
  • beginEnd : Array (optional)

    The caller can specify on which indices to slice

Returns

( String value, Boolean anyMatch, Boolean caseSensitive, Boolean exactMatch )private

Returns a regular expression based on the given value and matching options. This is used internally for finding and filtering, and by Ext.data.Store.filter

Parameters

  • value : String

    The value to create the regex for. This is escaped using Ext.escapeRe

  • anyMatch : Boolean

    True to allow any match - no regex start/end line anchors will be added. Defaults to false

  • caseSensitive : Boolean

    True to make the regex case sensitive (adds 'i' switch to regex). Defaults to false.

  • exactMatch : Boolean

    True to force exact match (^ and $ characters added to the regex). Defaults to false. Ignored if anyMatch is true.

Normalizes an array of sorter objects, ensuring that they are all Ext.util.Sorter instances

Parameters

  • sorters : Object[]

    The sorters array

Returns

遍历集合,并用每一个item作为参数,执行指定的函数, passing the following arguments: item : MixedThe collection item index : NumberThe item...

遍历集合,并用每一个item作为参数,执行指定的函数, passing the following arguments:

  • item : Mixed

    The collection item

  • index : Number

    The item's index

  • length : Number

    The total number of items in the collection

The function should return a boolean value. Returning false from the function will stop the iteration.

Parameters

  • fn : Function

    The function to execute for each item.

  • scope : Object (optional)

    The scope (this reference) in which the function is executed. Defaults to the current item in the iteration.

Executes the specified function once for every key in the collection, passing each key, and its associated item as th...

Executes the specified function once for every key in the collection, passing each key, and its associated item as the first two parameters.

Parameters

  • fn : Function

    The function to execute for each item.

  • scope : Object (optional)

    The scope (this reference) in which the function is executed. Defaults to the browser window.

通过调用this.getBubbleTarget()(如果存在)允许本Observable对象触发的事件沿着继承体系起泡 在Observable基类中没有实现类。 ...

通过调用this.getBubbleTarget()(如果存在)允许本Observable对象触发的事件沿着继承体系起泡 在Observable基类中没有实现类。

这通常被Ext.Components用来将事件起泡到它的容器。 见Ext.Component.getBubbleTarget。Ext.Component中的默认实现 返回Component的直接容器。但是如果需要一个明显的target, 它可以被重写 以更快地访问需要的target。

使用范例:

Ext.override(Ext.form.field.Base, {
    //  Add functionality to Field's initComponent to enable the change event to bubble
    initComponent : Ext.Function.createSequence(Ext.form.field.Base.prototype.initComponent, function() {
        this.enableBubble('change');
    }),

    //  We know that we want Field's events to bubble directly to the FormPanel.
    getBubbleTarget : function() {
        if (!this.formPanel) {
            this.formPanel = this.findParentByType('form');
        }
        return this.formPanel;
    }
});

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

Parameters

  • eventNames : String/String[]

    待起泡的事件名,或者事件名数组。

( Object config )private

拓展

Parameters

Extracts all of the given property values from the items in the MC. Mainly used as a supporting method for functions like sum and collect.

Parameters

  • property : String

    The property to extract

  • root : String (optional)

    'root' property to extract the first argument from. This is used mainly when extracting field data from Model instances, where the fields are stored inside the 'data' object

Returns

  • Array

    The extracted values

Filters the objects in this collection by a set of Filters, or by a single property/value pair with optional paramete...

Filters the objects in this collection by a set of Filters, or by a single property/value pair with optional parameters for substring matching and case sensitivity. See Filter for an example of using Filter objects (preferred). Alternatively, MixedCollection can be easily filtered by property like this:

//create a simple store with a few people defined
var people = new Ext.util.MixedCollection();
people.addAll([
    {id: 1, age: 25, name: 'Ed'},
    {id: 2, age: 24, name: 'Tommy'},
    {id: 3, age: 24, name: 'Arne'},
    {id: 4, age: 26, name: 'Aaron'}
]);

//a new MixedCollection containing only the items where age == 24
var middleAged = people.filter('age', 24);

Parameters

  • property : Ext.util.Filter[]/String

    A property on your objects, or an array of Filter objects

  • value : String/RegExp

    Either string that the property values should start with or a RegExp to test against the property

  • anyMatch : Boolean (optional)

    True to match any part of the string, not just the beginning

    Defaults to: false

  • caseSensitive : Boolean (optional)

    True for case sensitive comparison.

    Defaults to: false

Returns

Filter by a function. Returns a new collection that has been filtered. The passed function will be called with each object in the collection. If the function returns true, the value is included otherwise it is filtered.

Parameters

  • fn : Function

    The function to be called, it will receive the args o (the object), k (the key)

  • scope : Object (optional)

    The scope (this reference) in which the function is executed. Defaults to this MixedCollection.

Returns

Returns the first item in the collection which elicits a true return value from the passed selection function. ...

Returns the first item in the collection which elicits a true return value from the passed selection function.

Parameters

  • fn : Function

    The selection function to execute for each item.

  • scope : Object (optional)

    The scope (this reference) in which the function is executed. Defaults to the browser window.

Returns

  • Object

    The first item in the collection which returned true from the selection function, or null if none was found

( String property, String/RegExp value, [Number start], [Boolean anyMatch], [Boolean caseSensitive] ) : Number

Finds the index of the first matching object in this collection by a specific property/value.

Parameters

  • property : String

    The name of a property on your objects.

  • value : String/RegExp

    A string that the property values should start with or a RegExp to test against the property.

  • start : Number (optional)

    The index to start searching at.

    Defaults to: 0

  • anyMatch : Boolean (optional)

    True to match any part of the string, not just the beginning.

    Defaults to: false

  • caseSensitive : Boolean (optional)

    True for case sensitive comparison.

    Defaults to: false

Returns

  • Number

    The matched index or -1

Find the index of the first matching object in this collection by a function. If the function returns true it is considered a match.

Parameters

  • fn : Function

    The function to be called, it will receive the args o (the object), k (the key).

  • scope : Object (optional)

    The scope (this reference) in which the function is executed. Defaults to this MixedCollection.

  • start : Number (optional)

    The index to start searching at.

    Defaults to: 0

Returns

  • Number

    The matched index or -1

依据传递的比较函数或者当前的排序函数,计算新插入的项的索引。

Parameters

  • newItem : Object

    待计算索引的项

  • sorterFn : Function (optional)

    排序函数。它与传递给 sortBy的排序函数相同。它接受2个MixedCollection的项 并依据这2项的大小返回-1 0或者 1

    如果省略这个参数, 当前定义的sorters集合生成的函数 将会被使用。

Returns

  • Number

    使用insert往MixedCollection中插入新项的位置

使用传递过来的参数(去掉事件名,加上传递给addListener的options对象 )触发指定的事件。 ...

使用传递过来的参数(去掉事件名,加上传递给addListeneroptions对象 )触发指定的事件。

通过调用enableBubble,一个事件 能被设置为沿着Observable的继承体系(见Ext.Component.getBubbleTarget)向上起泡。

Parameters

  • eventName : String

    待触发的事件名。

  • args : Object...

    传递给事件处理函数的可变数量的参数

Returns

  • Boolean

    如果任何一个事件处理函数返回false,就返回false,否则返回true。

Returns the first item in the collection.

Returns

  • Object

    the first item in the collection..

返回一个比较器函数,比较两个项, 根据当前定义的sorters集合返回 -1, 0或者1。 ...

返回一个比较器函数,比较两个项, 根据当前定义的sorters集合返回 -1, 0或者1。

如果没有定义{@olink sorters},它返回一个函数。这个函数返回0,表示不会进行排序

Returns the item associated with the passed key OR index. Key has priority over index. This is the equivalent of calling getByKey first, then if nothing matched calling getAt.

Parameters

Returns

  • Object

    If the item is found, returns the item. If the item was not found, returns undefined. If an item was found, but is a Class, returns null.

Returns the item at the specified index.

Parameters

  • index : Number

    The index of the item.

Returns

  • Object

    The item at the specified index.

Gets the bubbling parent for an Observable

Returns

Returns the item associated with the passed key.

Parameters

Returns

  • Object

    The item associated with the passed key.

( Object name )private

得到配置项

Parameters

Returns the number of items in the collection.

Returns

  • Number

    the number of items in the collection.

得到初始化配置项

Parameters

MixedCollection has a generic way to fetch keys if you implement getKey. The default implementation simply returns item.id but you can provide your own implementation to return a different value as in the following examples:

// normal way
var mc = new Ext.util.MixedCollection();
mc.add(someEl.dom.id, someEl);
mc.add(otherEl.dom.id, otherEl);
//and so on

// using getKey
var mc = new Ext.util.MixedCollection();
mc.getKey = function(el){
   return el.dom.id;
};
mc.add(someEl);
mc.add(otherEl);

// or via the constructor
var mc = new Ext.util.MixedCollection(false, function(el){
   return el.dom.id;
});
mc.add(someEl);
mc.add(otherEl);

Parameters

  • item : Object

    The item for which to find the key.

Returns

  • Object

    The key for the passed item.

Returns a range of items in this collection

Parameters

  • startIndex : Number (optional)

    The starting index. Defaults to 0.

  • endIndex : Number (optional)

    The ending index. Defaults to the last item.

Returns

( Object config )private

根据名称判断配置项是否存在

Parameters

检查本对象是否有特定事件的监听器, 或者检查事件是否起泡。 检查的结果表明事件是否需要出发。

Parameters

  • eventName : String

    待检查的事件名

Returns

  • Boolean

    如果事件被监听或者起泡,返回true, 否则返回false

Returns index within the collection of the passed Object.

Parameters

  • o : Object

    The item to find the index of.

Returns

  • Number

    index of the item. Returns -1 if not found.

Returns index within the collection of the passed key.

Parameters

  • key : String

    The key to find the index of.

Returns

( Object config ) : Objectprotected
这个类的初始化配置。典型例子: Ext.define('My.awesome.Class', { // 这是默认配置 config: { name: 'Awesome', isAwes...

这个类的初始化配置。典型例子:

Ext.define('My.awesome.Class', {
    // 这是默认配置
    config: {
        name: 'Awesome',
        isAwesome: true
    },

    constructor: function(config) {
        this.initConfig(config);
    }
});

var awesome = new My.awesome.Class({
    name: 'Super Awesome'
});

alert(awesome.getName()); // 'Super Awesome' 超级棒

Parameters

Returns

  • Object

    mixins 混入原型 键-值对

初始化本混入元素。使用本混入元素的组件类 应该在它们初始化时调用这个方法。 ...

初始化本混入元素。使用本混入元素的组件类 应该在它们初始化时调用这个方法。

Inserts an item at the specified index in the collection. Fires the add event when complete.

Parameters

  • index : Number

    The index to insert the item at.

  • key : String

    The key to associate with the new item, or the item itself.

  • o : Object (optional)

    If the second parameter was a key, the new item.

Returns

Returns the last item in the collection.

Returns

  • Object

    the last item in the collection..

( Object name, Object mixinClass )private

内部使用混入预处理器(mixins pre-processor)

Parameters

addManagedListener的简写方法 向任何Observable对象(或者Ext.Element)添加监听器, 当组件被销毁时,监听器自动被移除 ...

addManagedListener的简写方法

向任何Observable对象(或者Ext.Element)添加监听器, 当组件被销毁时,监听器自动被移除

Parameters

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

    添加监听器的目标项。

  • ename : Object/String

    事件名或者包含的事件名属性的对象。

  • fn : Function

    (可选的) 如果ename参数是事件名, 这就是一个事件处理函数。

  • scope : Object

    (可选的) 如果ename参数是事件名, 这就是(this引用的上下文) 事件处理函数执行的作用域。

  • opt : Object

    (可选的)如果ename参数是事件名, 这就是addListener的选项。

removeManagedListener的简写方法 移除通过mon方法添加的监听器。 ...

removeManagedListener的简写方法

移除通过mon方法添加的监听器。

Parameters

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

    待移除监听器的项

  • ename : Object/String

    事件名或者包含的事件名属性的对象。

  • fn : Function

    (可选的) 如果ename参数是事件名, 这就是一个事件处理函数。

  • scope : Object

    (可选的) 如果ename参数是事件名, 这就是(this引用的上下文) 事件处理函数执行的作用域。

( String/Object eventName, [Function fn], [Object scope], [Object options] )
addListener的简写方法 向本对象添加一个事件处理函数,例如: myGridPanel.on("mouseover", this.onMouseOver, this); 这个方法也允许传递单个参数,参数为一个 包含指定...

addListener的简写方法

向本对象添加一个事件处理函数,例如:

myGridPanel.on("mouseover", this.onMouseOver, this);

这个方法也允许传递单个参数,参数为一个 包含指定多个事件的属性的配置对象。例如:

myGridPanel.on({
    cellClick: this.onCellClick,
    mouseover: this.onMouseOver,
    mouseout: this.onMouseOut,
    scope: this // Important. Ensure "this" is correct during handler execution
});

你也能为每个事件处理函数单独指定选项:

myGridPanel.on({
    cellClick: {fn: this.onCellClick, scope: this, single: true},
    mouseover: {fn: panel.onMouseOver, scope: panel}
});

也能使用在特定作用域的方法。注意 必须指定scope:

myGridPanel.on({
    cellClick: {fn: 'onCellClick', scope: this, single: true},
    mouseover: {fn: 'onMouseOver', scope: panel}
});

Parameters

  • eventName : String/Object

    被监听的事件名。 也可以是属性名字是事件名字的对象。

  • fn : Function (optional)

    事件调用的方法, 或者如果指定了scope,在指定scope的方法名*。 会被调用, 参数为fireEvent的参数加上下述options参数。

  • scope : Object (optional)

    事件处理函数执行的作用域(this应用的上下文) 如果省略, 默认为触发事件的对象。

  • options : Object (optional)

    包含事件处理函数配置的对象。

    注意: 不像ExtJS 3.x, options对象也会作为最后一个参数 传递给每一个事件处理函数。

    这个对象可能包含以下任何一个属性:

    • scope : Object

      事件处理函数执行的作用域(this应用的上下文) 如果省略, 默认为触发事件的对象。

    • delay : Number

      事件触发后,调用事件处理函数延时毫秒数。

    • single : Boolean

      设置为true添加一个事件处理函数,只处理下一次触发的事件, 然后移除这个函数。

    • buffer : Number

      使事件处理函数在Ext.util.DelayedTask中调度运行, 延时指定的毫秒数。如果事件在这段事件再次触发, 原先的事件处理函数再调用, 新的事件处理函数接替。

    • target : Ext.util.Observable

      只有当事件在目标Observable上触发时调用事件处理函数, 如果事件是从Observable的子类起泡的,不会调用事件处理函数

    • element : String

      这个选项只对绑定在Components上的监听器有效。 Component的一个属性名,这个属性引用一个待添加监听器的元素

      这个选项在Component构造过程中向Components的元素添加DOM事件监听器有用。 这些元素只有在Component渲染之后才会存在。 例如, 向Panel的body中添加click监听器:

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

      组合选项

      使用options参数, 可以组合不同类型的监听器:

      一个延时的一次性监听器:

      myPanel.on('hide', this.handleClick, this, {
          single: true,
          delay: 100
      });
      
( Object names, Object callback, Object scope )private

更新配置项

Parameters

( Object fn, Object scope )private

扩展事件

Parameters

让给定的类成为可观察的实例。 这个方法在有类从本类派生或者使用本类作为一个mixin时调用。

Parameters

( Object origin, String[] events, [String prefix] )

从指定的Observable接替选定的事件就好像事件是this触发的。

例如,如果你想要扩展Grid, 你可能决定转发store的一些事件。 所以你能在你的initComponent中实现这个:

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

grid实例将会有一个observable的'load'事件, 这个事件的参数是store的load事件的参数。任何grid的load事件触发的函数 可以使用this访问grid。

Parameters

  • origin : Object

    本对象要接替事件的Observable对象

  • events : String[]

    被接替的事件名数组

  • prefix : String (optional)

    附加到事件名的公共前缀。例如:

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

    这样grid将会以'storeload'和'storeclear'转发store的'load'和'clear'事件。

Remove an item from the collection.

Parameters

  • o : Object

    The item to remove.

Returns

  • Object

    The item removed or false if no item was removed.

Remove all items in the passed array from the collection.

Parameters

  • items : Array

    An array of items to be removed.

Returns

Remove an item from a specified index in the collection. Fires the remove event when complete.

Parameters

  • index : Number

    The index within the collection of the item to remove.

Returns

  • Object

    The item removed or false if no item was removed.

Removed an item associated with the passed key fom the collection.

Parameters

  • key : String

    The key of the item to remove.

Returns

  • Object

    The item removed or false if no item was removed.

移除事件处理函数。

Parameters

  • eventName : String

    事件处理函数关联的事件类型

  • fn : Function

    待移除的事件处理函数。 必须是对传递给addListener 的函数的引用。

  • scope : Object

    (可选的) 原先为事件处理函数指定的作用域。 它必须是和原先调用addListener时指定的作用域参数是一样的,否者监听器将会被移除。

移除通过mon方法添加的监听器。

Parameters

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

    待移除监听器的项

  • ename : Object/String

    事件名或者包含的事件名属性的对象。

  • fn : Function

    (可选的) 如果ename参数是事件名, 这就是一个事件处理函数。

  • scope : Object

    (可选的) 如果ename参数是事件名, 这就是(this引用的上下文) 事件处理函数执行的作用域。

Remove a single managed listener item

Parameters

  • isClear : Boolean

    True if this is being called during a clear

  • managedListener : Object

    The managed listener item See removeManagedListener for other args

根据一个从旧索引到新索引的映射重新排序所有的项。重排序在 内部被当做一个排序。重排序时触发'sort'事件。 ...

根据一个从旧索引到新索引的映射重新排序所有的项。重排序在 内部被当做一个排序。重排序时触发'sort'事件。

Parameters

  • mapping : Object

    旧索引到新索引的映射

替换集合中的对象. Fires the replace event when complete.

Parameters

  • key : String

    The key associated with the item to replace, or the replacement item.

    If you supplied a getKey implementation for this MixedCollection, or if the key of your stored items is in a property called id, then the MixedCollection will be able to derive the key of the replacement item. If you want to replace an item with one having the same key value, then just pass the replacement item in this parameter.

  • o : Object

    {Object} o (optional) If the first parameter passed was a key, the item to associate with that key.

Returns

继续事件的触发(见suspendEvents)。

如果事件被使用queueSuspended参数挂起, 那么所有 在事件挂起期间触发的事件将会被发送到任意监听器。

( Object config, Object applyIfNotSet )private

设置配置项

Parameters

使用一个或多个排序Store中的数据。使用范例: //sort by a single field myStore.sort('myField', 'DESC'); //sorting by multiple fields myS...

使用一个或多个排序Store中的数据。使用范例:

//sort by a single field
myStore.sort('myField', 'DESC');

//sorting by multiple fields
myStore.sort([
    {
        property : 'age',
        direction: 'ASC'
    },
    {
        property : 'name',
        direction: 'DESC'
    }
]);

Store在内部将参数转换为Ext.util.Sorter实例数组, 把实际的排序过程委托给它内部的Ext.util.MixedCollection

当传递单个字符串参数时, Store给每一个字段保存了一个ASC/DESC切换器,所以如下代码:

store.sort('myField');
store.sort('myField');

等价于如下代码, 因为Store实现自动的切换:

store.sort('myField', 'ASC');
store.sort('myField', 'DESC');

Parameters

  • sorters : String/Ext.util.Sorter[]

    本Store的配置的Model的一个字段的字符串名字, 或者排序器配置数组。

  • direction : String

    数据排序方向。默认为"ASC"。

Returns

使用单个排序函数给集合排序

Parameters

根据给集合排序。

Parameters

  • direction : String

    (可选的) 'ASC'或者'DESC'。默认为'ASC'。

  • fn : Function

    (可选的) 定义排序顺序的比较函数。 默认排序不区分大小写

获取从该对象被实例化的类的引用。 请注意不同于 self, this.statics()是独立的作用域,无论this是否运行,总是返回其中的调用类。

Ext.define('My.Cat', {
    statics: {
        totalCreated: 0,
        speciesName: 'Cat' // My.Cat.speciesName = 'Cat'
    },

    constructor: function() {
        var statics = this.statics();

        alert(statics.speciesName);     // 总是等于'Cat',无论'this'是什么,
                                        // 相当于:My.Cat.speciesName

        alert(this.self.speciesName);   // 依赖 'this'

        statics.totalCreated++;
    },

    clone: function() {
        var cloned = new this.self;                      // 依赖 'this'

        cloned.groupName = this.statics().speciesName;   // 相当于: My.Cat.speciesName

        return cloned;
    }
});


Ext.define('My.SnowLeopard', {
    extend: 'My.Cat',

    statics: {
        speciesName: 'Snow Leopard'     // My.SnowLeopard.speciesName = 'Snow Leopard'
    },

    constructor: function() {
        this.callParent();
    }
});

var cat = new My.Cat();                 // alerts 'Cat', 然后提示 'Cat'

var snowLeopard = new My.SnowLeopard(); // alerts 'Cat', 然后提示 'Snow Leopard'

var clone = snowLeopard.clone();
alert(Ext.getClassName(clone));         // alerts 'My.SnowLeopard'
alert(clone.groupName);                 // alerts 'Cat'

alert(My.Cat.totalCreated);             // alerts 3

Returns

Collects all of the values of the given property and returns their sum

Parameters

  • property : String

    The property to sum by

  • root : String (optional)

    'root' property to extract the first argument from. This is used mainly when summing fields in records, where the fields are all stored inside the 'data' object

  • start : Number (optional)

    The record index to start at

    Defaults to: 0

  • end : Number (optional)

    The record index to end at

    Defaults to: -1

Returns

挂起所有事件的触发。(见resumeEvents)

Parameters

  • queueSuspended : Boolean

    传true,让挂起的事件排队而不是丢弃所有挂起的事件, 这些事件将会在调用resumeEvents之后触发。

配置扩展

removeListener的简写方法 移除事件处理函数。 ...

removeListener的简写方法

移除事件处理函数。

Parameters

  • eventName : String

    事件处理函数关联的事件类型

  • fn : Function

    待移除的事件处理函数。 必须是对传递给addListener 的函数的引用。

  • scope : Object

    (可选的) 原先为事件处理函数指定的作用域。 它必须是和原先调用addListener时指定的作用域参数是一样的,否者监听器将会被移除。

Defined By

Events

当添加一个项到 集合中时触发.

Parameters

当集合被清空的时候触发.

Parameters

当一个项在集合中被移除时触发.

Parameters

当一个项在集合中被替换时触发.

Parameters