码迷,mamicode.com
首页 > Web开发 > 详细

Extjs使用Ext.function.bind, 给句柄函数传参

时间:2016-01-28 18:44:43      阅读:357      评论:0      收藏:0      [点我收藏+]

标签:

 

回调函数updateImage中的key参数,在外部调用时有程序员自己指定.

使用Ext.Function.bind(this.updateImage, this, ‘imageUrl‘, true)

参数一:updateImage函数引用,   

参数二:this(固定写法)

参数三:程序员自定义updateImage函数引用中的key参数值

参数四:true (固定写法)

showSelectImageWindow: function() {
        var me = this.getView();
        this.selectImage(Ext.Function.bind(this.updateImage, this, ‘imageUrl‘, true));
    },
    
    showSelectLogoWindow: function() {
        var me = this.getView();
        this.selectImage(Ext.Function.bind(this.updateImage, this, ‘logoUrl‘, true));
    },
    
    showSelectPhotoWindow: function() {
        var me = this.getView();
        this.selectImage(Ext.Function.bind(this.updateImage, this, ‘bzLicensePhotoUrl‘, true));
    },
    
    selectImage: function(callback) {
        if (!this.imgWindow) {
            this.imgWindow = Ext.create(‘app.ux.window.SelectImageWindow‘, {
                callback: callback
            });
        } else {
            Ext.apply(this.imgWindow, {callback: callback});
        }
        this.imgWindow.show();
    },
    
    updateImage: function(url, title, uploadId, key) {
        this.getView().getViewModel().set(key, url);
    },

 

Extjs使用Ext.function.bind, 给句柄函数传参

标签:

原文地址:http://www.cnblogs.com/cocoat/p/5166984.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!