我正在尝试在 GeoExt Map App 上创建 CSV 文件上传。我需要将上传功能放在 Ext.Action 中,这样我就可以将它添加到 GeoExt 面板的工具栏中。我正在尝试实现这个例子。这是我的代码,
action = new Ext.Action({
text: "Upload Excel",
control: Ext.create('Ext.form.Panel', {
title: 'Upload a CSV File',
width: 400,
bodyPadding: 10,
frame: true,
renderTo: Ext.getBody(),
items: [{
xtype: 'filefield',
name: 'csv',
fieldLabel: 'CSV Upload',
labelWidth: 50,
msgTarget: 'side',
allowBlank: false,
buttonText: 'Select CSV File'
}],
buttons: [{
text: 'Upload',
handler: function () {
var form = this.up('form')
.getForm();
if (form.isValid()) {
form.submit({
url: 'file-upload.py',
waitMsg: 'Uploading the CSV File...',
success: function (fp, o) {
Ext.Msg.alert('Success', 'Your csv file "' + o.result.file + '" has been uploaded.');
}
});
}
}
}]
}),
map: map,
// button options
tooltip: "Upload CSV File",
// check item options
group: "newTool"
});
actions["upCSV"] = action;
toolbarItems.push(new Ext.button.Button(action));
Firebug 一直给我这个错误,
TypeError: b[d.xtype || e] is not a constructor
我是否在 Ext.Action 中错误地声明了函数?