问题描述
代码如下:<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>templateAdmin</title><link rel="stylesheet" type="text/css" href="../../resource/js/ext/resources/css/ext-all.css" /><script type="text/javascript" src="../../resource/js/ext/adapter/ext/ext-base.js" ></script><script type="text/javascript" src="../../resource/js/ext/ext-all-debug.js"></script><link href="../../resource/js/ext/resources/css/xtheme-silverCherry.css" rel="stylesheet" type="text/css" /><link href="../../resource/css/common.css" type="text/css" rel="stylesheet" /><script type="text/javascript">Ext.onReady(function(){Ext.BLANK_IMAGE_URL = '../../resource/images/s.gif';Ext.addForm = new Ext.form.FormPanel({region:'center',bodyStyle:'padding-top:65px; padding-left:130px;',labelWidth:40,labelAlign:'right',frame:true,items:[{xtype:'textfield',fieldLabel:'模板',id:'file',name:'file',inputType:'file',cls:'x-form-item'},{ xtype:"combo", fieldLabel: '模型', id:'combo', name: 'combo', store: new Ext.data.SimpleStore({ fields: ['value', 'text'], data: [ ['value1', 'text1'], ['value2', 'text2'] ] }), displayField: 'text', valueField: 'value', mode: 'local', emptyText:'请选择', cls:'x-form-item', triggerAction: 'all' }],buttons:[{text:'添加',handler:function(){alert(Ext.getCmp('file').getValue() + ' ' + Ext.getCmp('combo').getValue());}},{text:'重置',handler:function(){Ext.addForm.getForm().reset();}}]});Ext.TmpAdminPanel = new Ext.Panel({renderTo:'content',width:500,height:300,layout:'border',frame:true,items:[Ext.addForm]}); });</script><style type="text/css">.x-form-item {float:left;margin-bottom:30px;}</style></head><body><div id="content" style="padding-top:20px;padding-left: 200px;"></div></body></html>模型重置成功!但模板重置不成功!不知为什么?? 问题补充:babydeed 写道
解决方案
只有这样了,文本框叫A(这个文本框是普通的文本框) 后面是个按钮 一点这个按钮 弹出一个window里面是一个{ xtype:'textfield', fieldLabel:'模板', id:'file', name:'file', inputType:'file', cls:'x-form-item' }, 下面有个按钮确定 一点确定 就这个window里面的你所选择的文件地址给文本框A 然后 弹出的window隐藏或者销毁
解决方案二:
inputType:'file', 这样的东西 只读的