大家好,我在js页面中添加了一个组件,有点问题。
    var importPanel = new Ext.FormPanel({
     renderTo: 'fi-form',
id:'importPanel',
        baseCls:"x-plain",
        fileUpload:true,
        encType:"multipart/form-data",
        bodyStyle:'margin-top:5px;',
        width:260,
        frame: true,
        title: 'File Upload Form',
        defaults: {
            anchor: '95%',
            allowBlank: false,
            msgTarget: 'side'
        },
        items: [
         {
            xtype: 'fileuploadfield', 
            id: 'form-file',
            fieldLabel: 'Execl',
            emptyText: 'Select an Excel',
            name: 'filepath',
            buttonText: '',
//             buttonOnly: true,
            buttonCfg: {
                iconCls: 'exporticon'
            },
            listeners: {
            'fileselected': function(fb, v){
             var flag = true;
   var path = v;
   if(path.trim()!=="") {
   if(path.substring(path.lastIndexOf("."))==".xls"){
    flag = false;
  //          var obj = Ext.getCmp('importPanel');
            importPanel.getForm().submit({
         method : 'POST',
         url: "moudleFileImport.html",
         success : function(){
           var config = { 
title:'消息', 
msg: '2' 
};
Ext.Msg.show(config); 

setTimeout(function(){
                 Ext.Msg.hide();
},2000); 

 
         },
          failure : function() {
           Ext.MessageBox.alert("错误","系统连接超时,请联系管理员或稍后再试!");
         }
        });
    }
    } 
     if(flag) {
     Ext.Msg.alert('提示', '请选择Excel(.xls)文件!');
     }
            }
        }
         }] 
    });
  不加这个组件,能显示,光写了这个组件,ie就说 行8 字符118674 错误 缺少对象。但是我不知道缺少什么对象,看了ext example的例子也是这样写的,我是看我同事的列子写的,他的能运行,但是我的不行。有高手帮组一下吗?应该和listeners:中的代码没有太大的关系。listeners:删了还是有错。

解决方案 »

  1.   

    用alert慢慢调吧。或者换firefox用firebug来debug
      

  2.   

    xtype : 'fileuploadfield',
    id : 'form-file',
    emptyText : '选择文件',
    fieldLabel : '选择文件',
    name : 'fileName',
    buttonText : '选择',
    buttonCfg : {
    iconCls : 'upload-icon'
    }
    我在ext3.0上使用这个组件,是在网上下载的,ext库中没有(这个EXT4.0中Ext.form.field.File很像)
    是不是你没有导入这个文件啊<script src="../js/FileUploadField.js"  type="text/javascript"></script>  
      

  3.   

    楼上的看到你最后一句,我突然震惊了。果然没+ 就+了css,泪流满面啊。。谢谢。。太谢谢你了今天就上线了。。我要加油了。