当前位置:编程学习 > JAVA >>

return与break

  width:400,
        height:300,
        layout:'form',
        bodyStyle:'padding:10px',
        labelWidth:70,
        defaults:{anchor:'100%'},
        items:[{
            xtype:'iconcombo',
            fieldLabel:'IconCombo',
            store: store123,
            valueField: 'countryCode',
            displayField: 'countryName',
            iconClsField: 'countryFlag',
            triggerAction: 'all',
            mode: 'local'
        }],
        buttons:[{
            text: '提交',
            handler: function() {
             //方式一:进行遍历combobox进行删除
             //方式二:使用combobox事件进行,直接获取index,然后进行删除
             var count=store123.getTotalCount();
             for(var k=0;k<count;k++){
                    if(store123.getAt(k).get('countryName')=='United States'){
                     store123.remove(store123.getAt(k));
                     break;
                     /*
                     为了提高性能,注意在for和while中使用break和continue关键字。
                     在这里注意break和return的区别
                     break结束的是循环
                     return结束的是本次方法。
                     */
                    }
             }
            }
        }]

作者“shijinling87807697”
 

补充:软件开发 , Java ,
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,