qq_34192448 2017-07-28 03:23 采纳率: 0%
浏览 616

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条回答 默认 最新

  • dabocaiqq 2018-07-02 16:08
    关注
    评论

报告相同问题?

悬赏问题

  • ¥15 matlab有关常微分方程的问题求解决
  • ¥15 perl MISA分析p3_in脚本出错
  • ¥15 k8s部署jupyterlab,jupyterlab保存不了文件
  • ¥15 ubuntu虚拟机打包apk错误
  • ¥199 rust编程架构设计的方案 有偿
  • ¥15 回答4f系统的像差计算
  • ¥15 java如何提取出pdf里的文字?
  • ¥100 求三轴之间相互配合画圆以及直线的算法
  • ¥100 c语言,请帮蒟蒻写一个题的范例作参考
  • ¥15 名为“Product”的列已属于此 DataTable