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

  • 相关阅读:
    hello world!
    react(一):组件的生命周期
    position和BFC
    继承
    绕不开的this
    js世界这么大,闭包想看看
    js中数组常用方法总结
    Appium混合应用测试
    手机APP兼容性测试
    运行monitor提示需要安装旧JAVA SE 6运行环境
  • 原文地址:https://www.cnblogs.com/zrui-xyu/p/4615948.html
Copyright © 2020-2023  润新知