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)
    }

  • 相关阅读:
    01.网页学习阶段、整站分析、规划
    书签搬运
    如何判断两个链表相交及找到第一个相交点
    Windows平台使用git bash管理github中的工程
    二级指针的操作
    结构体的内存对齐
    大端和小端
    剑指Offer——面试题26:复杂链表的复制
    使用editcap命令将ERF格式转换为pcap格式
    如何在STL的map中使用结构体作为键值
  • 原文地址:https://www.cnblogs.com/zrui-xyu/p/4615948.html
Copyright © 2011-2022 走看看