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

  • 相关阅读:
    通过游戏认识 --- JQuery与原生JS的差异
    HTML5对音视频的处理
    原生JS实现Ajax及Ajax的跨域请求
    开发手机APP的神器 --- ionic
    面向对象(OOP)--OOP基础与this指向详解
    Angular JS中的路由
    JQuery实现banner图滚动
    项目完成总结
    小组项目第五周总结
    小组项目第四周总结
  • 原文地址:https://www.cnblogs.com/zrui-xyu/p/4615948.html
Copyright © 2011-2022 走看看