Extjs中给同一个GridPanel中的事件添加参数的方法
Extjs中給同一個GridPanel中的事件添加參數的方法:
this.isUse = new Ext.Action({
?? ??? ??? ?text:'啟用',
?? ??? ??? ?scope:this,
?? ??? ??? ?handler:this.isUseWin.createDelegate (this,[1])
?? ??? ?});
?? ??? ?this.isNotUse = new Ext.Action({
?? ??? ??? ?text:'停用',
?? ??? ??? ?scope:this,
?? ??? ??? ?handler:this.isUseWin.createDelegate (this,[0])
?});
?
接收的時候:
isUseWin:function(e){
?? ??? ?/** 選中的記錄 */
?? ??? ?var records = this.getSelectionModel().getSelections();
?? ??? ?/** 存放id的數組 */
?? ??? ?var array = [];
?? ??? ?if (records == null || records.length == 0) {
?? ??? ??? ?Ext.MessageBox.show({
?? ??? ??? ??? ??? ??? ?title : '警告',
?? ??? ??? ??? ??? ??? ?icon : Ext.MessageBox.WARNING,
?? ??? ??? ??? ??? ??? ?buttons : Ext.MessageBox.OK,
?? ??? ??? ??? ??? ??? ?msg : '請選擇一條的記錄'
?? ??? ??? ??? ??? ?});
?? ??? ??? ?return false;
?? ??? ?}
?? ??? ?// 遍歷記錄將id放入數組
?? ??? ?Ext.each(records, function(record) {
?? ??? ??? ?array.push(record.data.unitId);
?? ??? ?})
?? ??? ?Ext.MessageBox.confirm('提示','你確定要啟用選中的記錄嗎?',function(button){
?? ??? ??? ?if(button =='yes'){
?? ??? ??? ??? ?Ext.Ajax.request({
?? ??? ??? ??? ??? ?url:this.useUrl,
?? ??? ??? ??? ??? ?method:'POST',
?? ??? ??? ??? ??? ?params:{
?? ??? ??? ??? ??? ??? ?unitIds:array.join(','),
?? ??? ??? ??? ??? ??? ?isUsing:e
?? ??? ??? ??? ??? ?},
?? ??? ??? ??? ??? ?success:function(response,options){
?? ??? ??? ??? ??? ??? ?var text = Ext.decode(response.responseText);
?? ??? ??? ??? ??? ??? ?Ext.Msg.alert('提示',text.msg,function(){
?? ??? ??? ??? ??? ??? ??? ?this.store.reload();
?? ??? ??? ??? ??? ??? ?},this);
?? ??? ??? ??? ??? ?},
?? ??? ??? ??? ??? ?failure:function(){
?? ??? ??? ??? ??? ??? ?Ext.Msg.alert('提示','請求失敗!');
?? ??? ??? ??? ??? ?},
?? ??? ??? ??? ??? ?scope:this
?? ??? ??? ??? ?});
?? ??? ??? ?}
?? ??? ?},this)
}
轉載于:https://www.cnblogs.com/zrui-xyu/p/4615948.html
總結
以上是生活随笔為你收集整理的Extjs中给同一个GridPanel中的事件添加参数的方法的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Mysqli面向对象操作数据库
- 下一篇: 【学习Koa】原生koa2 静态资源服务