extjs 文件上传对话框显示后,页面出现空白的,之前的写法是整个panel用Ext.form.panel,
修改为只有文件上传部分的控件用ext.form.panel包含,整个页面用Ext.panel.panel包含,
可以避免这个问题。
1 Ext.define('MyApp.view.MyPanel', {
2 extend: 'Ext.panel.Panel',
3
4 height: 375,
5 width: 557,
6 layout: {
7 type: 'border'
8 },
9 title: 'My Panel',
10
11 initComponent: function() {
12 var me = this;
13
14 Ext.applyIf(me, {
15 items: [
16 {
17 xtype: 'gridpanel',
18 title: 'My Grid Panel',
19 region: 'center',
20 columns: [
21 {
22 xtype: 'gridcolumn',
23 dataIndex: 'string',
24 text: 'String'
25 },
26 {
27 xtype: 'numbercolumn',
28 dataIndex: 'number',
29 text: 'Number'
30 },
31 {
32 xtype: 'datecolumn',
33 dataIndex: 'date',
34 text: 'Date'
35 },
36 {
37 xtype: 'booleancolumn',
38 dataIndex: 'bool',
39 text: 'Boolean'
40 }
41 ],
42 viewConfig: {
43
44 }
45 },
46 {
47 xtype: 'container',
48 height: 110,
49 layout: {
50 type: 'border'
51 },
52 region: 'north',
53 items: [
54 {
55 xtype: 'form',
56 bodyPadding: 10,
57 title: '',
58 region: 'center',
59 items: [
60 {
61 xtype: 'filefield',
62 id:'upfile',//需要通过ID,获得控件的form,在执行提交动作
63 width: 534,
64 fieldLabel: 'Label',
65 anchor: '100%'
66 },
67 {
68 xtype: 'button',
69 text: 'MyButton'
70 }
71 ]
72 }
73 ]
74 }
75 ]
76 });
77
78 me.callParent(arguments);
79 }
80
81 });
2 extend: 'Ext.panel.Panel',
3
4 height: 375,
5 width: 557,
6 layout: {
7 type: 'border'
8 },
9 title: 'My Panel',
10
11 initComponent: function() {
12 var me = this;
13
14 Ext.applyIf(me, {
15 items: [
16 {
17 xtype: 'gridpanel',
18 title: 'My Grid Panel',
19 region: 'center',
20 columns: [
21 {
22 xtype: 'gridcolumn',
23 dataIndex: 'string',
24 text: 'String'
25 },
26 {
27 xtype: 'numbercolumn',
28 dataIndex: 'number',
29 text: 'Number'
30 },
31 {
32 xtype: 'datecolumn',
33 dataIndex: 'date',
34 text: 'Date'
35 },
36 {
37 xtype: 'booleancolumn',
38 dataIndex: 'bool',
39 text: 'Boolean'
40 }
41 ],
42 viewConfig: {
43
44 }
45 },
46 {
47 xtype: 'container',
48 height: 110,
49 layout: {
50 type: 'border'
51 },
52 region: 'north',
53 items: [
54 {
55 xtype: 'form',
56 bodyPadding: 10,
57 title: '',
58 region: 'center',
59 items: [
60 {
61 xtype: 'filefield',
62 id:'upfile',//需要通过ID,获得控件的form,在执行提交动作
63 width: 534,
64 fieldLabel: 'Label',
65 anchor: '100%'
66 },
67 {
68 xtype: 'button',
69 text: 'MyButton'
70 }
71 ]
72 }
73 ]
74 }
75 ]
76 });
77
78 me.callParent(arguments);
79 }
80
81 });
Ext.getCmp('upfile').getForm().submit({
waitTitle : '系统提示',
waitMsg : '正在上传,请等待...',// 动作发生期间显示的文本信息
url: 'Fileupload.aspx',//fileUploadServlet
method : 'POST',// 表单提交方式
params : request,
success: onSuccess,
failure: onFailure
});
waitTitle : '系统提示',
waitMsg : '正在上传,请等待...',// 动作发生期间显示的文本信息
url: 'Fileupload.aspx',//fileUploadServlet
method : 'POST',// 表单提交方式
params : request,
success: onSuccess,
failure: onFailure
});