1. #1
    Touch Premium Member
    Join Date
    Nov 2010
    Location
    Chicago
    Posts
    1,407
    Vote Rating
    179
    LesJ is a splendid one to behold LesJ is a splendid one to behold LesJ is a splendid one to behold LesJ is a splendid one to behold LesJ is a splendid one to behold LesJ is a splendid one to behold LesJ is a splendid one to behold

      0  

    Default Ext loads too much code

    Ext loads too much code


    See the code fragment... the panel Header loads the Ext.draw.Component.

    The draw.Component requires pretty much the entire draw package. It loads both engines: VML and SVG, and it doesn't event check if the engine is supported. This is a ton of code, see this open ticket.

    I suggest adding conditional resource loading or even creating two header types: Vertical and Horizontal.

    Code:
    Ext.define('Ext.panel.Header', {
        extend: 'Ext.container.Container',
        uses: ['Ext.panel.Tool', 'Ext.draw.Component', 'Ext.util.CSS', 'Ext.layout.component.Body', 'Ext.Img'],

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,547
    Vote Rating
    872
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    The issue is that the uses and requires need to be there before the class is created so you can't add to the uses array in the constructor.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Touch Premium Member
    Join Date
    Nov 2010
    Location
    Chicago
    Posts
    1,407
    Vote Rating
    179
    LesJ is a splendid one to behold LesJ is a splendid one to behold LesJ is a splendid one to behold LesJ is a splendid one to behold LesJ is a splendid one to behold LesJ is a splendid one to behold LesJ is a splendid one to behold

      0  

    Default


    Quote Originally Posted by mitchellsimoens View Post
    The issue is that the uses and requires need to be there before the class is created so you can't add to the uses array in the constructor.
    I'd consider adding a conditional resource loader... perhaps along the line of yepnope.

    ... but even code like this would be more efficient:

    Code:
    Ext.define('Ext.draw.Surface', {
        ...
        requires: ['Ext.draw.CompositeSprite'],
    
        // uses: ['Ext.draw.engine.Svg', 'Ext.draw.engine.Vml', 'Ext.draw.engine.SvgExporter', 
    'Ext.draw.engine.ImageExporter'],
    
        uses: Ext.supports.Svg ? ['Ext.draw.engine.Svg', 'Ext.draw.engine.SvgExporter', 'Ext.draw.engine.ImageExporter'] : ['Ext.draw.engine.Vml'],
    Most of the time the headers are horizontal, so the drawing package is not needed.
    Last edited by LesJ; 6 Feb 2012 at 8:05 AM. Reason: Correct Ext.supports

Thread Participants: 1