+++ /dev/null
-/*\r
- * Ext JS Library 2.2.1\r
- * Copyright(c) 2006-2009, Ext JS, LLC.\r
- * licensing@extjs.com\r
- * \r
- * http://extjs.com/license\r
- */\r
-\r
-Ext.namespace('Ext.ux');\r
-\r
-/**\r
- * @class Ext.ux.ComponentLoader\r
- * Provides an easy way to load components dynamically. If you provide these components\r
- * with an id you can use Ext.ComponentMgr's onAvailable function to manipulate the components\r
- * as they are added.\r
- * @singleton\r
- */\r
-Ext.ux.ComponentLoader = function() {\r
- var cm = Ext.ComponentMgr; \r
- return {\r
- /*\r
- * \r
- */\r
- root: 'components',\r
- /*\r
- * Load components from a server resource, config options include anything available in @link Ext.data.Connect#request\r
- * Note: Always uses the connection of Ext.Ajax \r
- */\r
- load : function(config) {\r
- Ext.apply(config, {\r
- callback: this.onLoad.createDelegate(this, [config.container], true),\r
- scope: this\r
- }); \r
- if (config.container) {\r
- Ext.apply(config.params, {\r
- container: config.container\r
- });\r
- }\r
- Ext.Ajax.request(config);\r
- },\r
- // private\r
- onLoad : function(opts, success, response, ct) { \r
- var config = Ext.decode(response.responseText);\r
- if (config.success) {\r
- var comps = config[this.root]; \r
- // loop over each component returned. \r
- for (var i = 0; i < comps.length; i++) {\r
- var c = comps[i];\r
- // special case of viewport, no container to add to\r
- if (c.xtype && c.xtype === 'viewport') {\r
- cm.create(c);\r
- // add to container\r
- } else {\r
- var ct = c.container || ct;\r
- Ext.getCmp(ct).add(c);\r
- Ext.getCmp(ct).doLayout();\r
- }\r
- }\r
- \r
- } else {\r
- this.onFailure();\r
- }\r
- },\r
- onFailure: function() {\r
- Ext.Msg.alert('Load failed.');\r
- }\r
- };\r
-}();
\ No newline at end of file