qq_34192448
2017-07-28 03:23Extjs3 中如何在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条回答
为你推荐
- 如何在javascript中将组合框(EXTJS)中的参数传递给php文件?
- javascript
- extjs
- php
- 1个回答
- ExtJS+Struts2使用ajax上传文件问题
- extjs
- 0个回答
- EXTJS4.2的gird中如何设置表头加粗特定行或者列加粗?
- extjs4
- 3个回答
- extjs?Java?读取文件,写入数据库!!!
- 数据库
- java
- extjs
- 3个回答
- Extjs 在子窗体点击按钮后 再弹出一个子页面
- extjs
- 2个回答