extjs button ajax,extjs - Have a button that submits data without AJAX while other buttons submit th...

i have an EXT.formPanel in which i'd like to have this beahaviour: two buttons should submit through ajax and one shouldn't. How to do this?

This is my code:

form = new Ext.FormPanel({

frame:true,

width:Ext.crl.styles.formWidth,

title: 'Ricerca Atti',

bodyStyle:'padding:5px 5px 0',

defaultType: 'textfield',

formId:'search-form',

keys: [

{ key: [Ext.EventObject.ENTER], handler: function(){

ds.baseParams = form.getForm().getValues();

form.getForm().submit({url:urlRicerca,

waitMsg:'Ricerca in corso…', submitEmptyText: false, method:'GET',params: { start: 0, limit: PAGE_SIZE},

success:function(form,action) {Ext.crl.utils.searchOnSuccess(ds, action, grid); }

});

}

}

],

items: [

ricercaSemplice,

ricercaAvanzata,

{ //This button should submit NOT submit through AJAX!!!

text: 'Esporta Elenco',

disabled:false,

style: 'float:right;',

xtype: 'button',

handler: function() {

ds.baseParams = form.getForm().getValues();

form.getForm().submit({url:urlRicerca+".xls",

waitMsg:'Ricerca in corso…', submitEmptyText: false, method:'GET',params: { enableCsvFilter: "yes", start: 0, limit: PAGE_SIZE},

success:function(form,action) {console.log(action); }

});

}

},{

text: 'Reimposta',

xtype: 'button',

style: 'float:right;margin-right:10px',

disabled: false,

handler: function() {

form.getForm().reset();

//window.location.href = window.location.href;

}

},{

id: 'bottoreCercaRicerca',

name: 'bottoreCercaRicerca',

text: 'Cerca',

xtype: 'button',

style: 'float:right;margin-right:10px',

disabled: false,

handler: function() {

ds.baseParams = form.getForm().getValues();

form.getForm().submit({url:urlRicerca,

waitMsg:'Ricerca in corso…', submitEmptyText: false, method:'GET',params: { start: 0, limit: PAGE_SIZE},

success:function(form,action) {Ext.crl.utils.searchOnSuccess(ds, action, grid); }

});

}

},{

name: 'buttonSwitchRicerca',

xtype: 'button',

style: 'margin-bottom:10px',

text: 'Ricerca Avanzata',

handler: function() {

if(ricercaAvanzata.hidden) {

this.setText('Ricerca Standard');

ricercaAvanzata.show();

}

else {

this.setText('Ricerca Avanzata');

ricercaAvanzata.hide();

}

}

},

DEFAULT_SPACER,

Ext.crl.modalitaLavoro.comboModalitalavoro

]

});

I'v written a comment on where the button should NOT use ajax.

EDIT - i've found a solution, this is an handler that works for not submitting through ajax (actually the fact that opens in a new window is something i want) what i need. Are there any other options?

handler: function() {

query = form.getForm().getValues(true);

query += "&enableCsvFilter=yes";

var url = urlRicerca + ".xls?" + query;

window.open(url);

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值