我正嘗試在GeoExt地圖應用上創建一個CSV文件上傳。 我需要將上傳功能放在Ext.Action中,以便我可以將其添加到GeoExt面板的工具欄中。我正試圖執行這個example。這裏是我的代碼,添加CSV上傳瀏覽按鈕到Ext.Action
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));
螢火蟲不斷給我這個錯誤,
TypeError: b[d.xtype || e] is not a constructor
難道我不當聲明Ext.Action內的功能?
你設法解決這個問題嗎?我遇到了同樣的問題... – avn