File upload 将CSV上载浏览按钮添加到外部操作
我正在尝试在GeoExt地图应用程序上创建CSV文件上载。 我需要将上传功能放在Ext.Action中,以便将其添加到GeoExt面板的工具栏中。我正在努力实现这一点。这是我的密码File upload 将CSV上载浏览按钮添加到外部操作,file-upload,extjs,csv,openlayers,extjs3,File Upload,Extjs,Csv,Openlayers,Extjs3,我正在尝试在GeoExt地图应用程序上创建CSV文件上载。 我需要将上传功能放在Ext.Action中,以便将其添加到GeoExt面板的工具栏中。我正在努力实现这一点。这是我的密码 action = new Ext.Action({ text: "Upload Excel", control: Ext.create('Ext.form.Panel', { title: 'Upload a CSV File', width: 400,
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]不是构造函数
我是否在Ext.Action中错误地声明了函数?您不能直接将
操作
推入工具栏
,因为Ext.Action
不是Ext.Component
的一种类型。Ext.Action
基本上是一种创建可多次重用的抽象层的方法。在这里,您需要执行以下操作:
toolbarItems.push(new Ext.button.Button(action));
从:
操作允许您共享处理程序、配置选项和UI更新
跨任何支持操作界面的组件(主要是
Ext.toolbar.toolbar、Ext.button.button和Ext.menu.menu组件)
您不能直接将
操作
推入工具栏
,因为Ext.action
不是Ext.Component
的类型。Ext.Action
基本上是一种创建可多次重用的抽象层的方法。在这里,您需要执行以下操作:
toolbarItems.push(new Ext.button.Button(action));
从:
操作允许您共享处理程序、配置选项和UI更新
跨任何支持操作界面的组件(主要是
Ext.toolbar.toolbar、Ext.button.button和Ext.menu.menu组件)
那么我该如何为这个按钮添加功能呢?就像我在答案
toolbarItems.push(newext.button.button(action))中所说的那样代码>我更新了代码,但错误仍然存在。它仍然给我同样的错误。您可以在firebug中看到错误。您不能使用new Ext.create()
。这就是问题所在。它只能是Ext.create
。抱歉,它仍然不工作。我更新了代码。它继续给我同样的错误。那么我如何给这个按钮添加功能呢?就像我在回答toolbarItems.push(newext.button.button(action))中所说的那样代码>我更新了代码,但错误仍然存在。它仍然给我同样的错误。您可以在firebug中看到错误。您不能使用new Ext.create()
。这就是问题所在。它只能是Ext.create
。抱歉,它仍然不工作。我更新了代码。它继续给我同样的错误。你解决了这个问题吗?我遇到了同样的问题…你解决了吗?我遇到了同样的问题。。。