私は隠しフォームを作成し、クリック時に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);
}
});
は
this.form.dom.submit({
success: function(response) {
console.log('success');
},
failure: function(response) {
console.log('failure');
}
});
を提出するのparamsを追加しようとしました。しかし、これは助けにはなりませんでした。
が作成できますこれのための例のフィドル?そこの問題を解決することができます。 –
フォームを使用する理由はありますか?どのデータを送信していますか? – MarthyM