我有一个按钮,创建一个隐藏的表单,并调用form.dom.submit()上点击。我需要添加成功和失败回调才能提交操作。 下面的代码:ExtJS的4:添加成功/失败回调form.dom.submit()动作
Ext.define("DownloadButton", {
extend: 'Ext.button.Button',
download: function (me, event) {
this.form.dom.submit();
},
initComponent: function() {
this.handler = Ext.Function.bind(this.download, this.scope || this);
this.callParent(arguments);
},
afterRender: function() {
this.callParent(arguments);
this.form = this.getEl().createChild({
tag: 'form',
cls: 'x-hidden',
method: 'POST',
action: this.fileUrl,
target: this.getId() + '-form-iframe'
});
this.getEl().appendChild(this.form);
}
});
尝试添加PARAMS提交
this.form.dom.submit({
success: function(response) {
console.log('success');
},
failure: function(response) {
console.log('failure');
}
});
但这并没有帮助。
你能创建一个例如小提琴这个?可以解决那里的问题。 –
是否有任何理由使用表单?你发送了什么数据? – MarthyM