X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/7a654f8d43fdb43d78b63d90528bed6e86b608cc..f562e4c6e5fac7bcb445985b99acbea4d706e6f0:/src/ElementLoader.js diff --git a/src/ElementLoader.js b/src/ElementLoader.js index 50ae590b..7ec6cc34 100644 --- a/src/ElementLoader.js +++ b/src/ElementLoader.js @@ -1,19 +1,30 @@ +/* + +This file is part of Ext JS 4 + +Copyright (c) 2011 Sencha Inc + +Contact: http://www.sencha.com/contact + +GNU General Public License Usage +This file may be used under the terms of the GNU General Public License version 3.0 as published by the Free Software Foundation and appearing in the file LICENSE included in the packaging of this file. Please review the following information to ensure the GNU General Public License version 3.0 requirements will be met: http://www.gnu.org/copyleft/gpl.html. + +If you are unsure which license is appropriate for your use, please contact the sales department at http://www.sencha.com/contact. + +*/ /** - * @class Ext.ElementLoader * A class used to load remote content to an Element. Sample usage: - *
-Ext.get('el').load({
- url: 'myPage.php',
- scripts: true,
- params: {
- id: 1
- }
-});
- *
- * - * In general this class will not be instanced directly, rather the {@link Ext.core.Element#load} method + * + * Ext.get('el').load({ + * url: 'myPage.php', + * scripts: true, + * params: { + * id: 1 + * } + * }); + * + * In general this class will not be instanced directly, rather the {@link Ext.Element#load} method * will be used. - *
*/ Ext.define('Ext.ElementLoader', { @@ -27,81 +38,109 @@ Ext.define('Ext.ElementLoader', { 'Ext.data.Connection', 'Ext.Ajax' ], - + statics: { Renderer: { Html: function(loader, response, active){ loader.getTarget().update(response.responseText, active.scripts === true); return true; } - } + } }, /* End Definitions */ /** - * @cfg {String} url The url to retrieve the content from. Defaults to null. + * @cfg {String} url + * The url to retrieve the content from. */ url: null, /** - * @cfg {Object} params Any params to be attached to the Ajax request. These parameters will - * be overridden by any params in the load options. Defaults to null. + * @cfg {Object} params + * Any params to be attached to the Ajax request. These parameters will + * be overridden by any params in the load options. */ params: null, /** * @cfg {Object} baseParams Params that will be attached to every request. These parameters - * will not be overridden by any params in the load options. Defaults to null. + * will not be overridden by any params in the load options. */ baseParams: null, /** - * @cfg {Boolean/Object} autoLoad True to have the loader make a request as soon as it is created. Defaults to false. + * @cfg {Boolean/Object} autoLoad + * True to have the loader make a request as soon as it is created. * This argument can also be a set of options that will be passed to {@link #load} is called. */ autoLoad: false, /** - * @cfg {Mixed} target The target element for the loader. It can be the DOM element, the id or an Ext.Element. + * @cfg {HTMLElement/Ext.Element/String} target + * The target element for the loader. It can be the DOM element, the id or an {@link Ext.Element}. */ target: null, /** - * @cfg {Mixed} loadMask True or a string to show when the element is loading. + * @cfg {Boolean/String} loadMask + * True or a string to show when the element is loading. */ loadMask: false, /** - * @cfg {Object} ajaxOptions Any additional options to be passed to the request, for example timeout or headers. Defaults to null. + * @cfg {Object} ajaxOptions + * Any additional options to be passed to the request, for example timeout or headers. */ ajaxOptions: null, - + /** - * @cfg {Boolean} scripts True to parse any inline script tags in the response. + * @cfg {Boolean} scripts + * True to parse any inline script tags in the response. */ scripts: false, /** - * @cfg {Function} success A function to be called when a load request is successful. + * @cfg {Function} success + * A function to be called when a load request is successful. + * Will be called with the following config parameters: + * + * - this - The ElementLoader instance. + * - response - The response object. + * - options - Ajax options. */ /** * @cfg {Function} failure A function to be called when a load request fails. + * Will be called with the following config parameters: + * + * - this - The ElementLoader instance. + * - response - The response object. + * - options - Ajax options. + */ + + /** + * @cfg {Function} callback A function to be called when a load request finishes. + * Will be called with the following config parameters: + * + * - this - The ElementLoader instance. + * - success - True if successful request. + * - response - The response object. + * - options - Ajax options. */ /** - * @cfg {Object} scope The scope to execute the {@link #success} and {@link #failure} functions in. + * @cfg {Object} scope + * The scope to execute the {@link #success} and {@link #failure} functions in. */ - + /** - * @cfg {Function} renderer A custom function to render the content to the element. The passed parameters - * are - *