1. #1
    Sencha User
    Join Date
    Apr 2011
    Posts
    29
    Vote Rating
    0
    Dengqiao Huang is on a distinguished road

      0  

    Default I do not know where a problem.

    I do not know where a problem.


    Test Case:
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    <html>
    <head>
        <title></title>
        <link rel="stylesheet" type="text/css" href="../../Ext4/resources/css/ext-all.css"/>    
        <script type="text/javascript" src="../../Ext4/bootstrap.js"></script>
        <script type="text/javascript" src="../../Ext4/locale/Ext-lang-zh_CN.js"></script>
        <style type="text/css">
            .upload{background: url("../../images/upload.png") no-repeat scroll 0 0 transparent }
        </style>
    </head>
    <body>    
        <script type="text/javascript">
            Ext.onReady(function(){
                if(Ext.BLANK_IMAGE_URL.substr(0,4)!="data"){                
                    Ext.BLANK_IMAGE_URL="./images/s.gif";
                }
                
                Ext.create("Ext.panel.Panel",{
                    title:"filefield",
                    width:300,
                    height:600,
                    renderTo:Ext.getBody(),
                    bodyStyle:"background:#DFE9F6",
                    layout:"vbox",
                    defaults:{xtype:"form",bodyPadding:5,
                        bodyStyle:"background:#DFE9F6",height:90,width:"100%",
                        url:"Upload.ashx",
                        defaultType:"filefield",
                        fieldDefaults:{labelWidth:80,msgTarget:"side",
                            labelSeparator:":",allowBlank:false,anchor:"0"
                        },                    
                        bbar:[
                            {text:"Save",handler:function(){
                                var f=this.up("form").getForm();
                                if(f.isValid())
                                    f.submit({
                                        success:function(f,s){
                                            var img=Ext.getCmp("img");
                                            img.setSrc(s.result.msg);
                                        }
                                    });
                            }}
                        ]
                    },
                    items:[
                        {title:"Normal",items:[
                            {fieldLabel:"File",buttonText:"Select",name:"Filedata"}
                        ]},
                        {title:"Button",height:120,items:[
                            {buttonText:"Select",name:"Filedata",buttonOnly:true,
                                listeners:{
                                    change:function(f,v){
                                        Ext.getCmp("selectFile").setText(v);
                                    }
                                }
                            },
                            {xtype:"label",id:"selectFile"}
                        ]},
                        {title:"Image Button",items:[
                            {fieldLabel:"File",name:"Filedata",buttonText:"",
                                buttonConfig:{iconCls:"upload"}
                            }
                        ]},
                        {xtype:"image",id:"img",height:250}
                    ]
                })
            });
        </script>
    </body>
    </html>
    In 4.0.7:
    4-1.jpg

    In 4.1:
    4-2.jpg

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    St. Louis, MO
    Posts
    33,684
    Vote Rating
    435
    mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of

      0  

    Default


    In your defaults you have 'width : "100%"' but in a vbox layout, width only takes a number not a string. If you want the width to be 100% of the available width change this line:

    Code:
    layout : "vbox"
    to

    Code:
    layout : {
        type  : 'vbox',
        align : 'stretch'
    }
    and remove the width : "100%"
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    http://www.JSONPLint.com - Source to lint your JSONP!

    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 almost in print!

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

  3. #3
    Sencha User
    Join Date
    Apr 2011
    Posts
    29
    Vote Rating
    0
    Dengqiao Huang is on a distinguished road

      0  

    Default I have solved the problem.

    I have solved the problem.


    I have solved the problem.

    Modify the layout of the definition:
    Code:
    layout:{type:"vbox",align:"stretch"},
    Delete:
    Code:
    width: "100%",

  4. #4
    Sencha User
    Join Date
    Apr 2011
    Posts
    29
    Vote Rating
    0
    Dengqiao Huang is on a distinguished road

      0  

    Default


    Thanks!