zoukankan      html  css  js  c++  java
  • 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)
    }

  • 相关阅读:
    《CLR Via C# 第3版》笔记之(十四) 泛型高级
    《CLR Via C# 第3版》笔记之(十三) 泛型基础
    AOP学习基于Emit和Attribute的简单AOP实现
    《CLR Via C# 第3版》笔记之(十五) 接口
    C# 连接Oracle(利用ODP.net,不安装oracle客户端)
    《CLR Via C# 第3版》笔记之(十七) 线程基础
    C#直接读取磁盘文件(类似linux的Direct IO模式)
    《CLR Via C# 第3版》笔记之(十六) 字符串
    [置顶] C#中通过调用webService获取上网IP地址的区域的方法
    Android中Socket通讯类
  • 原文地址:https://www.cnblogs.com/zrui-xyu/p/4615948.html
Copyright © 2011-2022 走看看