X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/c930e9176a5a85509c5b0230e2bff5c22a591432..05ce1c11e98b33f14ddee184493bd5a60dc947e2:/docs/source/Observable-more.html diff --git a/docs/source/Observable-more.html b/docs/source/Observable-more.html index 341c052e..2bd2141d 100644 --- a/docs/source/Observable-more.html +++ b/docs/source/Observable-more.html @@ -1,11 +1,17 @@ - -
-/** + + ++ \ No newline at end of fileThe source code + + + + +/*! + * Ext JS Library 3.0.3 + * Copyright(c) 2006-2009 Ext JS, LLC + * licensing@extjs.com + * http://www.extjs.com/license + */ +/** * @class Ext.util.Observable */ Ext.apply(Ext.util.Observable.prototype, function(){ @@ -123,21 +129,56 @@ Ext.apply(Ext.util.Observable.prototype, function(){ }, /** - * Used to enable bubbling of events - * @param {Object} events + *- +};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 {@link 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:
+ * @param {Object} events The event name to bubble, or an Array of event names. */ enableBubble: function(events){ var me = this; - events = Ext.isArray(events) ? events : Ext.toArray(arguments); - Ext.each(events, function(ename){ - ename = ename.toLowerCase(); - var ce = me.events[ename] || true; - if (typeof ce == "boolean") { - ce = new Ext.util.Event(me, ename); - me.events[ename] = ce; - } - ce.bubble = true; - }); + if(!Ext.isEmpty(events)){ + events = Ext.isArray(events) ? events : Ext.toArray(arguments); + Ext.each(events, function(ename){ + ename = ename.toLowerCase(); + var ce = me.events[ename] || true; + if (Ext.isBoolean(ce)) { + ce = new Ext.util.Event(me, ename); + me.events[ename] = ce; + } + ce.bubble = true; + }); + } } }; }()); @@ -176,6 +217,6 @@ Ext.util.Observable.observeClass = function(c){ return (c.fireEvent.apply(c, arguments) !== false) && (Ext.util.Observable.prototype.fireEvent.apply(this, arguments) !== false); }; -};+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"); + } + } +}); +