ExtJS4.x dynamically loads js files

Source: Internet
Author: User

Dynamic Loading of js files is a new feature of ext4.x, which can effectively reduce the pressure on the browser and improve the rendering speed. Such as dynamic loading of custom components 1. create a js file for custom components under the js/extjs/ux directory. 2. compile MyWindow. js file copy code Ext. define ('js. extjs. ux. mywindow'/* name must correspond to path */, {extend: 'ext. window. window ', title: 'dynamically loaded components', width: 400, height: 300, bodyStyle: 'background: # ffc; padding: 10px;', html: 'Hello, world '}); copy code 3. start ext's dynamic loading mechanism and set the path to be loaded Ext. loader. setConfig ({enabled: true, paths: {'myux ': 'js/extjs/ux'}); 4. create Ext. create ('js. extjs. ux. myWind Ow '). show (); 5. finished 6. Note that the js file is loaded only when the node is instantiated in step 1, instead of step 2.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.