Results 1 to 2 of 2

Thread: [3.4.0] Ext.Container defaults is not working like described in documentation

    You found a bug! We've classified it as a bug in our system. We encourage you to continue the discussion and to find an acceptable workaround while we work on a permanent fix.
  1. #1
    Sencha Premium Member matei's Avatar
    Join Date
    Jun 2008
    Location
    Cluj-Napoca
    Posts
    45
    Vote Rating
    1
      0  

    Default [3.4.0] Ext.Container defaults is not working like described in documentation

    in documentation for container : defaults I can see:

    "If an added item is a config object, and not an instantiated Component, then the default properties are unconditionally applied.
    If the added item is an instantiated Component, then the default properties are applied conditionally so as not to override existing properties in the item.
    "

    but if you try to apply defaults to Components it will allways override them even the compoent has those properties.

    if you run this code will see that all instances created with "new Ext.form.TextField({...})" have all properties with defaults from FormPanel, even first compoenent has values in his config.

    HTML Code:
     <html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
        <title>Ext apply defaults to item</title>
        <link rel="stylesheet" type="text/css" href="../../resources/css/ext-all.css"/>
         <script type="text/javascript" src="../../adapter/ext/ext-base.js"></script>
        <script type="text/javascript" src="../../ext-all.js"></script>
    
        <script type="text/javascript">
        Ext.onReady(function(){
            var form = new Ext.form.FormPanel({
                renderTo: Ext.getBody(),
                title: 'Form with defaults: {width: 200}',
                labelWidth: 150,
                defaults: {
                    width: 200,
                    value: 'default value',
                    xProperty: 'default x'
                },
                items: [
                    new Ext.form.TextField({
                        fieldLabel: 'Component width 300',
                        width: 300,
                        value: 'value',
                        xProperty: 'xProperty'
                    }),
                    new Ext.form.TextField({
                        fieldLabel: 'Component no width'
                    }),
                    {
                        xtype: 'textfield',
                        fieldLabel: 'config width 300',
                        width: 300,
                        value: 'value',se
                        xProperty: 'xProperty'
                    },
                    {
                        xtype: 'textfield',
                        fieldLabel: 'config no width'
                    }
                ]
            });
            
            form.items.each(function(item, i){
                if(console && console.info){
                    console.info(i, item.width, item.fieldLabel, "xProperty: ", item.xProperty);
                }
            })
        });
        </script>
    
    
        <!-- Common Styles for the examples -->
        <link rel="stylesheet" type="text/css" href="../shared/examples.css"/>
    </head>
    <body>
    </body>
    </html>
    Last edited by mitchellsimoens; 26 May 2012 at 4:12 AM. Reason: added item.width to console

  2. #2
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,411
    Vote Rating
    1290
      0  

    Default

    I have opened this as a bug report

    EXTJSIII-52
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it!

    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.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •