ExtJS4 window里面的formPanel不能显示

Ext window:

[code="java"] var addWin = Ext.create('Ext.window.Window', {
title : '角色添加',
id : 'addWin',
layout : "column",
border : false,
autoDestroy : false,
width : 450,
height : 250,
closeAction : 'hide',
plain : true,
modal : true,
constrain : true,
items : addForm
});[/code]

Ext formPanel:

[code="java"]var addForm = Ext.create('Ext.form.Panel', {
title : 'Simple Form',
id : 'addForm',
frame : true,
monitorValid : true,
bodyStyle : 'padding:5px 5px 0',
//layout : 'form',
fieldDefaults : {
labelAlign : 'top',
msgTarget : 'side'
},
//url : ctxpath + '/SystemManager/RoleList',
defaultType : 'textfield',
items : [ {
fieldLabel : '角色编号',
name : 'first',
allowBlank : false
}, {
fieldLabel : '角色名',
name : 'last',
allowBlank : false
} ],
buttons : [ {
text : '重置',
handler : function() {
//addForm.getForm().reset();
}
}, {
text : '提交',
formBind : true, //only enabled once the form is valid
disabled : true,
handler : function() {
// var form = addForm.getForm();
// if (form.isValid()) {
// form.submit( {
// success : function(form, action) {
// Ext.Msg.alert('Success', '1');
// },
// failure : function(form, action) {
// Ext.Msg.alert('Failed', '2');
// }
// });
// }
}
} ]
});[/code]

点击新增时,window可以展示,但是window中的formPanel不能显示。
如图:

:oops: 先写addForm ,再写addWin
[code="java"]


href="ext-all.css" /> Ext.onReady(function() { //添加角色form var addForm = Ext.create('Ext.form.Panel', { title : 'Simple Form', id : 'addForm', frame : true, border :false, monitorValid : true, width:250, heigth:200, //x:150, //y:150, layout:'fit', bodyStyle : 'padding:5px 5px 0', fieldDefaults : { labelAlign : 'top', msgTarget : 'side' }, //url : ctxpath + '/SystemManager/RoleList', defaultType : 'textfield', items : [ { fieldLabel : '角色编号', name : 'role.pk_juese', allowBlank : false }, { fieldLabel : '角色名', name : 'role.juesename', allowBlank : false } ], buttons : [ { text : '重置', handler : function() { //addForm.getForm().reset(); } }, { text : '提交', formBind : true, disabled : true, handler : function() { // var form = addForm.getForm(); // if (form.isValid()) { // form.submit( { // success : function(form, action) { // Ext.Msg.alert('Success', '1'); // }, // failure : function(form, action) { // Ext.Msg.alert('Failed', '2'); // } // }); // } } } ] }); var addWin = Ext.create('Ext.window.Window', { title : '角色添加', id : 'addWin', layout : "fit", autoDestroy : false, width : 450, height : 250, //x:100, //y:100, closeAction : 'hide', plain : true, modal : true, constrain : true, items : addForm }).show(); });


This is my JSP page.



[/code]

layout : "fit",