X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/3789b528d8dd8aad4558e38e22d775bcab1cbd36..6746dc89c47ed01b165cc1152533605f97eb8e8d:/docs/source/Ext-more.html diff --git a/docs/source/Ext-more.html b/docs/source/Ext-more.html index bc197784..5988f078 100644 --- a/docs/source/Ext-more.html +++ b/docs/source/Ext-more.html @@ -78,15 +78,23 @@ Ext.apply(Ext, { * @return {String} The generated Id. */ id: function(el, prefix) { + var me = this, + sandboxPrefix = ''; el = Ext.getDom(el, true) || {}; if (el === document) { - el.id = this.documentId; + el.id = me.documentId; } else if (el === window) { - el.id = this.windowId; + el.id = me.windowId; } if (!el.id) { - el.id = (prefix || "ext-gen") + (++Ext.idSeed); + if (me.isSandboxed) { + if (!me.uniqueGlobalNamespace) { + me.getUniqueGlobalNamespace(); + } + sandboxPrefix = me.uniqueGlobalNamespace + '-'; + } + el.id = sandboxPrefix + (prefix || "ext-gen") + (++Ext.idSeed); } return el.id; }, @@ -175,6 +183,12 @@ Ext.apply(Ext, { /** * Execute a callback function in a particular scope. If no function is passed the call is ignored. + * + * For example, these lines are equivalent: + * + * Ext.callback(myFunc, this, [arg1, arg2]); + * Ext.isFunction(myFunc) && myFunc.apply(this, [arg1, arg2]); + * * @param {Function} callback The callback to execute * @param {Object} scope (optional) The scope to execute in * @param {Array} args (optional) The arguments to pass to the function @@ -263,7 +277,7 @@ window.undefined = window.undefined; isWindows = check(/windows|win32/), isMac = check(/macintosh|mac os x/), isLinux = check(/linux/), - scrollWidth = null, + scrollbarSize = null, webKitVersion = isWebKit && (/webkit\/(\d+\.\d+)/.exec(Ext.userAgent)); // remove css image flicker @@ -271,7 +285,7 @@ window.undefined = window.undefined; document.execCommand("BackgroundImageCache", false, true); } catch(e) {} - Ext.setVersion('extjs', '4.0.0'); + Ext.setVersion('extjs', '4.0.2'); Ext.apply(Ext, { /** * URL to a blank file used by Ext when in secure mode for iframe src and onReady src to prevent @@ -544,7 +558,7 @@ function(el){ * @param {Mixed} defaultValue The value to return if the original value is empty * @param {Boolean} allowBlank (optional) true to allow zero length strings to qualify as non-empty (defaults to false) * @return {Mixed} value, if non-empty, else defaultValue - * @deprecated 4.0.0 Use {Ext#valueFrom} instead + * @deprecated 4.0.0 Use {@link Ext#valueFrom} instead */ value : function(v, defaultValue, allowBlank){ return Ext.isEmpty(v, allowBlank) ? defaultValue : v; @@ -601,54 +615,77 @@ Ext.addBehaviors({ } }, - /** - * Utility method for getting the width of the browser scrollbar. This can differ depending on + /** + * Returns the size of the browser scrollbars. This can differ depending on * operating system settings, such as the theme or font size. * @param {Boolean} force (optional) true to force a recalculation of the value. - * @return {Number} The width of the scrollbar. + * @return {Object} An object containing the width of a vertical scrollbar and the + * height of a horizontal scrollbar. */ - getScrollBarWidth: function(force){ + getScrollbarSize: function (force) { if(!Ext.isReady){ return 0; } - if(force === true || scrollWidth === null){ + if(force === true || scrollbarSize === null){ // BrowserBug: IE9 // When IE9 positions an element offscreen via offsets, the offsetWidth is // inaccurately reported. For IE9 only, we render on screen before removing. - var cssClass = Ext.isIE9 ? '' : Ext.baseCSSPrefix + 'hide-offsets'; + var cssClass = Ext.isIE9 ? '' : Ext.baseCSSPrefix + 'hide-offsets', // Append our div, do our calculation and then remove it - var div = Ext.getBody().createChild('<div class="' + cssClass + '" style="width:100px;height:50px;overflow:hidden;"><div style="height:200px;"></div></div>'), - child = div.child('div', true); - var w1 = child.offsetWidth; + div = Ext.getBody().createChild('<div class="' + cssClass + '" style="width:100px;height:50px;overflow:hidden;"><div style="height:200px;"></div></div>'), + child = div.child('div', true), + w1 = child.offsetWidth; + div.setStyle('overflow', (Ext.isWebKit || Ext.isGecko) ? 'auto' : 'scroll'); - var w2 = child.offsetWidth; + + var w2 = child.offsetWidth, width = w1 - w2; div.remove(); - // Need to add 2 to ensure we leave enough space - scrollWidth = w1 - w2 + 2; + + // We assume width == height for now. TODO: is this always true? + scrollbarSize = { width: width, height: width }; } - return scrollWidth; + + return scrollbarSize; + }, + + /** + * Utility method for getting the width of the browser's vertical scrollbar. This + * can differ depending on operating system settings, such as the theme or font size. + * + * This method is deprected in favor of {@link #getScrollbarSize}. + * + * @param {Boolean} force (optional) true to force a recalculation of the value. + * @return {Number} The width of a vertical scrollbar. + * @deprecated + */ + getScrollBarWidth: function(force){ + var size = Ext.getScrollbarSize(force); + return size.width + 2; // legacy fudge factor }, /** * Copies a set of named properties fom the source object to the destination object. - * <p>example:<pre><code> -ImageComponent = Ext.extend(Ext.Component, { - initComponent: function() { - this.autoEl = { tag: 'img' }; - MyComponent.superclass.initComponent.apply(this, arguments); - this.initialBox = Ext.copyTo({}, this.initialConfig, 'x,y,width,height'); - } -}); - * </code></pre> + * + * Example: + * + * ImageComponent = Ext.extend(Ext.Component, { + * initComponent: function() { + * this.autoEl = { tag: 'img' }; + * MyComponent.superclass.initComponent.apply(this, arguments); + * this.initialBox = Ext.copyTo({}, this.initialConfig, 'x,y,width,height'); + * } + * }); + * * Important note: To borrow class prototype methods, use {@link Ext.Base#borrow} instead. + * * @param {Object} dest The destination object. * @param {Object} source The source object. * @param {Array/String} names Either an Array of property names, or a comma-delimited list * of property names to copy. * @param {Boolean} usePrototypeKeys (Optional) Defaults to false. Pass true to copy keys off of the prototype as well as the instance. * @return {Object} The modified object. - */ + */ copyTo : function(dest, source, names, usePrototypeKeys){ if(typeof names == 'string'){ names = names.split(/[,;\s]/); @@ -667,7 +704,7 @@ ImageComponent = Ext.extend(Ext.Component, { * @param {Mixed} arg1 The name of the property to destroy and remove from the object. * @param {Mixed} etc... More property names to destroy and remove. */ - destroyMembers : function(o, arg1, arg2, etc){ + destroyMembers : function(o){ for (var i = 1, a = arguments, len = a.length; i < len; i++) { Ext.destroy(o[a[i]]); delete o[a[i]]; @@ -781,7 +818,7 @@ ImageComponent = Ext.extend(Ext.Component, { if (out.length >= max) { // this formula allows out.max to change (via debugger), where the // more obvious "max/4" would not quite be the same - out.splice(0, out.length - 3 * Math.floor(max / 4)); // keep newest 75% + Ext.Array.erase(out, 0, out.length - 3 * Math.floor(max / 4)); // keep newest 75% } out.push(message); @@ -816,8 +853,8 @@ Ext.partition( * </code></pre> * @param {Array|NodeList} arr The array to partition * @param {Function} truth (optional) a function to determine truth. If this is omitted the element - * itself must be able to be evaluated for its truthfulness. - * @return {Array} [true<Array>,false<Array>] + * itself must be able to be evaluated for its truthfulness. + * @return {Array} [array of truish values, array of falsy values] * @deprecated 4.0.0 Will be removed in the next major version */ partition : function(arr, truth){ @@ -926,9 +963,11 @@ Ext.zip( })(); /** - * TBD + * Loads Ext.app.Application class and starts it up with given configuration after the page is ready. + * + * See Ext.app.Application for details. + * * @param {Object} config - * @method */ Ext.application = function(config) { Ext.require('Ext.app.Application');