PDA

View Full Version : I do not know where a problem.



Dengqiao Huang
16 Jan 2012, 11:26 AM
Test Case:


<!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:
30750

In 4.1:
30751

mitchellsimoens
16 Jan 2012, 11:42 AM
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:


layout : "vbox"

to


layout : {
type : 'vbox',
align : 'stretch'
}

and remove the width : "100%"

Dengqiao Huang
16 Jan 2012, 11:49 AM
I have solved the problem.

Modify the layout of the definition:


layout:{type:"vbox",align:"stretch"},


Delete:


width: "100%",

Dengqiao Huang
16 Jan 2012, 11:50 AM
Thanks!