X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/c930e9176a5a85509c5b0230e2bff5c22a591432..2e847cf21b8ab9d15fa167b315ca5b2fa92638fc:/docs/output/Ext.util.Observable.html diff --git a/docs/output/Ext.util.Observable.html b/docs/output/Ext.util.Observable.html index 4e79f92b..b4c5cac8 100644 --- a/docs/output/Ext.util.Observable.html +++ b/docs/output/Ext.util.Observable.html @@ -1,4 +1,4 @@ -
Properties Methods Events Config Options Direct Link

Class Ext.util.Observable

Package:Ext.util
Defined In:Observable.js, Observable-more.js
Class:Observable
Subclasses:Component, Direct, History, ListView.ColumnResizer, ListView.Sorter, Resizable, SplitBar, Updater, Connection, DataProxy, Node, Store, Tree, DragTracker, Provider, BasicForm, AbstractSelectionModel, ColumnModel, GridView, PropertyStore, DefaultSelectionModel, MultiSelectionModel, TreeLoader, ClickRepeater, MixedCollection
Extends:Object
Base class that provides a common interface for publishing events. Subclasses are expected to +

Class Ext.util.Observable

Package:Ext.util
Defined In:Observable-more.js, Observable.js
Class:Observable
Subclasses:Component, Direct, History, Resizable, SplitBar, Updater, Connection, DataProxy, Node, Store, Tree, DragTracker, Provider, BasicForm, AbstractSelectionModel, ColumnModel, GridView, PropertyStore, ColumnResizer, Sorter, DefaultSelectionModel, MultiSelectionModel, TreeLoader, ClickRepeater, MixedCollection
Extends:Object
Base class that provides a common interface for publishing events. Subclasses are expected to to have a property "events" with all the events defined, and, optionally, a property "listeners" with configured listeners defined.
For example: @@ -87,7 +87,7 @@ Ext.DomObserver = Ext.extend(Object, { to the supplied function with the event name +...
<static> Starts capture on the specified Observable. All events will be passed to the supplied function with the event name + standard signature of the event before the event is fired. If the supplied function returns false, -the event will not fire.
Parameters:
  • o : Observable
    The Observable to capture
  • fn : Function
    The function to call
  • scope : Object
    (optional) The scope (this object) for the fn
Returns:
  • void
Observable Observable.observeClassFunction c ) +the event will not fire.
Parameters:
  • o : Observable
    The Observable to capture events from.
  • fn : Function
    The function to call when an event is fired.
  • scope : Object
    (optional) The scope (this reference) in which the function is executed. Defaults to the Observable firing the event.
Returns:
  • void
Observable Observable.observeClassFunction cObject listeners ) : void
<static> Sets observability on the passed class constructor. This makes any event fired on any instance of the passed class a...
<static> Sets observability on the passed class constructor.

@@ -95,12 +95,14 @@ This makes any event fired on any instance of the passed class a...

class allowing for central handling of events on many instances at once.

Usage:

Ext.util.Observable.observeClass(Ext.data.Connection);
 Ext.data.Connection.on('beforerequest', function(con, options) {
-    console.log("Ajax request made to " + options.url);
-});
Parameters:
  • c : Function
    The class constructor to make observable.
Returns:
  • void
Observable Observable.releaseCaptureObservable o ) + console.log('Ajax request made to ' + options.url); +});
Parameters:Returns:
Observable Observable.releaseCaptureObservable o ) : - void
<static> Removes all added captures from the Observable.
<static> Removes all added captures from the Observable.
Parameters:
  • o : Observable
    The Observable to release
Returns:
  • void
Observable addEventsObject object ) + void
<static> Removes all added captures from the Observable.
<static> Removes all added captures from the Observable.
Parameters:
  • o : Observable
    The Observable to release
Returns:
  • void
Observable addEventsObject|String ostring Optional. ) : - void
Used to define events on this Observable
Used to define events on this Observable
Parameters:
  • object : Object
    The object with the events defined
Returns:
  • void
Observable addListenerString eventNameFunction handler[Object scope][Object options] ) + void
Adds the specified events to the list of events which this Observable may fire.
Adds the specified events to the list of events which this Observable may fire.
Parameters:
  • o : Object|String
    Either an object with event names as properties with a value of true +or the first event name string if multiple event names are being passed as separate parameters.
  • Optional. : string
    Event name if multiple event names are being passed as separate parameters. +Usage:
    this.addEvents('storeloaded', 'storecleared');
Returns:
  • void
Observable addListenerString eventNameFunction handler[Object scope][Object options] ) : void
Appends an event handler to this object.
Appends an event handler to this object.
Parameters:
  • eventName : String
    The name of the event to listen for.
  • handler : Function
    The method the event invokes.
  • scope : Object
    (optional) The scope (this reference) in which the handler function is executed. If omitted, defaults to the object which fired the event.
  • options : Object
    (optional) An object containing handler configuration. @@ -121,8 +123,8 @@ Using the options argument, it is possible to combine different types of listene
    A delayed, one-time listener.
    myDataView.on('click', this.onClick, this, {
    -    single: true,
    -    delay: 100
    +single: true,
    +delay: 100
     });

    Attaching multiple handlers in 1 call
    @@ -130,30 +132,62 @@ The method also allows for a single argument to be passed which is a config obje which specify multiple handlers.

    myGridPanel.on({
    -    'click' : {
    -        fn: this.onClick,
    -        scope: this,
    -        delay: 100
    -    },
    -    'mouseover' : {
    -        fn: this.onMouseOver,
    -        scope: this
    -    },
    -    'mouseout' : {
    -        fn: this.onMouseOut,
    -        scope: this
    -    }
    +'click' : {
    +    fn: this.onClick,
    +    scope: this,
    +    delay: 100
    +},
    +'mouseover' : {
    +    fn: this.onMouseOver,
    +    scope: this
    +},
    +'mouseout' : {
    +    fn: this.onMouseOut,
    +    scope: this
    +}
     });

    Or a shorthand syntax:

    myGridPanel.on({
    -    'click' : this.onClick,
    -    'mouseover' : this.onMouseOver,
    -    'mouseout' : this.onMouseOut,
    -     scope: this
    -});
Returns:
  • void
Observable enableBubbleObject events ) +'click' : this.onClick, +'mouseover' : this.onMouseOver, +'mouseout' : this.onMouseOut, + scope: this +});Returns:Observable enableBubbleString/Array events ) : - void
Used to enable bubbling of events
Used to enable bubbling of events
Parameters:
  • events : Object
Returns:
  • void
Observable fireEventString eventNameObject... args ) + void
Enables events fired by this Observable to bubble up an owner hierarchy by calling +this.getBubbleTarget() if present...

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.override(Ext.form.Field, {
+    //  Add functionality to Field's initComponent to enable the change event to bubble

+    initComponent : Ext.form.Field.prototype.initComponent.createSequence(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:
  • events : String/Array
    The event name to bubble, or an Array of event names.
Returns:
  • void
Observable fireEventString eventNameObject... args ) : Boolean
Fires the specified event with the passed parameters (minus the event name). An event may be set to bubble up an Obse...

Fires the specified event with the passed parameters (minus the event name).