extjs上传excel模板 (2018-06-19 16:36:40)转载▼
分类: javascript/css
onUploadExcelTemplateForList: function () {
var me = this;
var form = Ext.getCmp(“UpLoadExcelForm”);
if (!form) {
form = Ext.create(“Ext.form.Panel”, {
id: ‘UpLoadExcelForm’,
alias: ‘widget.UpLoadExcelForm’,
fileUpload: true,
items: [{
id: ‘upload_excelfile1’,
name: ‘upload_excelfile1’,
xtype: ‘filefield’,
style: ‘z-index:100;opacity:100’,
hidden: true,
listeners: {
change: function (obj, newValue, oldValue) {
var listno = (me.form.findField(“listno”) ? me.form.findField(“listno”).getValue() : “”);
var listcode = (me.form.findField(“listcode”) ? me.form.findField(“listcode”).getValue() : “”);
var stockno = (me.form.findField(“stockno”) ? me.form.findField(“stockno”).getValue() : “”);
var compno = window.log_compno;
me.ajaxSubmit(form, ‘BaseList/uploadExcelTemplate.do’, {
listno: listno,
listcode: listcode,
stockno: stockno,
compno: compno
},
function (r) {
me.view.remove(form);
Ext.apply(me.grid.store.proxy.extraParams, {listno: listno});
me.grid.store.load();
}, function (e) {
me.msgError(e);
});
}
}
}]
});
}
this.view.add(form);
Ext.query(“input[type=file][id*=excelfile1]”)[0].click();
//form.down(“filefield”).button.getEl().dom.childNodes[1].click();也行
},