Extjs3 中如何在EditorGirdPanel的每列的某一个单元格内构建文件上传功能

supply.HTGLEditGridPanel = Ext.extend(Ext.ux.grid.EditorGridPanel, {
id:null,
frame:false,
border:false,
isAdd:true,
businessId:null,
fileUpload : true,
initComponent:function() {
var fields = [
{name: 'id', type: 'string'},
{name: 'businessid', type: 'string'},
{name: 'contractcode', type: 'string'},
{name: 'signcode', type: 'string'},
{name: 'contractname', type: 'string'},
{name: 'realname', type: 'string'},
{name: 'attribute', type: 'string'},
{name: 'note', type: 'string'}
];
var forms = new Ext.form.FormPanel({

fileUpload: true,

baseCls: 'x-plain',

layout:'form',

url: com.sjs.supply.action.ContractAction.uploadFile,

frame:true,

items: [
{
xtype : 'textfield',
title : '附件上传',
inputType : 'file',
itemId : 'uploadFileType',
}
],

buttons: [{

text: '上传',

handler: function() {

form.getForm().submit({

success: function(form, action){

Ext.Msg.alert('信息', '文件上传成功!');

},

failure: function(){

Ext.Msg.alert('错误', '文件上传失败');

}

});

}

}]

})
//时间
this.timeField = new Ext.ux.form.DateTimeField({
format:'Y-m-d H:i:s',
allowBlank:false,
selectOnFocus:true,
editable:false, width:150
});
//金额
this.amountField = new Ext.form.NumberField({
allowBlank:false,
maxLength:20,
width : 100
});

    //备注
    this.remarkField = new Ext.form.TextField({
        maxLength:500,
        width : 100
    });

      var data =  [["0","原件"], ["1","复印件"], ["2","其他"]];
      var Typestore = new Ext.data.SimpleStore({ fields:["value","text"],data:data });
      this.cm = new Ext.grid.ColumnModel([
        this.rowNumberer,
        this.sm,
        {header:'id',dataIndex:'id',hidden:true},
        {header:'业务编号',dataIndex:'businessid',hidden:true},
        {header:'合同编号',dataIndex:'contractcode',sortable:true,editor:new Ext.form.TextField()},
        {header:'签约编号',dataIndex:'signcode',sortable:true,editor:new Ext.form.TextField()},
        {header:'合同名称',dataIndex:'contractname',sortable:true,editor:new Ext.form.TextField()},
        {header:'扫描件',sortable:true,width:280,editor:forms},
        {header:'扫描件类型',dataIndex:'attribute',width:150,sortable:true,
                   editor:new Ext.form.ComboBox({    
                                  store:Typestore,
                                  mode:"local",
                                  displayField:"text",
                                  valueField:"value",
                                  triggerAction:"all",
                                  emptyText:"请选择",
                                  value:"text"  }),
                   renderer:function(value){ if(value == 0) return "原件"
                                             if(value == 1) return "复印件"
                                                            return "其他"}},
        {header:'备注',dataIndex:'note',sortable:true,editor:new Ext.form.TextField()},
    ]);
    this.store = this.createStore({
        searchFn:com.sjs.supply.action.SContractAction.getSContractPaginationList,
        deleteFn:com.sjs.supply.action.SContractAction.deleteSContract,
        updateFn:com.sjs.supply.action.SContractAction.updateSContract,
        fields:Ext.data.Record.create(fields),
        keyField:'id',
        sort:'id',
        dir:'ASC'
    });

    this.store.baseParams.businessId = this.businessId;
    this.tbar = this.createTbar({
        startEditing:2
    },true,true);
    this.tbar.add("-");
    this.bbar = this.createBbar(this.store);        
    supply.RKEditGridPanel.superclass.initComponent.call(this);
},
initNewRecord:function(Record){
    return new Record({
        attribute:0,
        businessid:this.businessId
    });
},  
loadStore:function(businessId){
    this.businessId = businessId;
    this.store.baseParams.businessId = businessId;
    this.store.load();
}

});

1个回答

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问