开发者

Dojo 1.4 how to bind an object

Here is my code:

dojo.provide("test.validation");

dojo.declare("test.validation", null, {
    addValidate : function(a) {
        this.a = dijit.byId(a);
        var link = dojo.connect(dijit.byId("form"), "onclick", this.validate);
    },

    validate : function(e)开发者_开发知识库 {
        e.preventDefault();
        console.log(this);
        if (!this.a.isValid()) {
            return false;
        }
    }
});

I would like call this: this.a.isValid() function, but I'm out of my object scope.

How can I bind it to that onclick event?


Have you tried reading about dojo.hitch()?
It deals exactly with those kind of problems.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜