开发者

how to terminate a function in `Ext.each`? [duplicate]

开发者 https://www.devze.com 2023-03-06 21:38 出处:网络
This question already has answers here: Clos开发者_如何学Pythoned 11 years ago. Possible Duplicate:
This question already has answers here: Clos开发者_如何学Pythoned 11 years ago.

Possible Duplicate:

How to break or continue Ext.each

exactly what i want to achieve is to check a string in an array,..

if the privilege is true, then return true...

var Data = {
    appPrivilege : [{
        module : "info",
        priv : true
    },{
        module : "about",
        priv : false
    }]
}

App = {
    AP : function(a){
        Ext.each(Data.appPrivilege, function(c){
            if (c.module == a && c.priv==true){
                console.info("here");
                //return true;
                return "a";
            }
        });
        return "b";
    }
}

console.info(App.AP("info"));

but in firebug it show here and b. how to terminate Ext.each ??


Ext and jQuery just wants the callback to return false

if (c.module == a && c.priv==true){
  console.info("here");
  return false;
}
0

精彩评论

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