ExtJs之Ext.each

<!DOCTYPE html>
<html>
<head>
    <title>ExtJs</title>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <link rel="stylesheet" type="text/css" href="ExtJs/packages/ext-theme-crisp/build/resources/ext-theme-crisp-all.css">
		<script type="text/javascript" src="ExtJs/ext-all.js"></script>
		<script type="text/javascript" src="ExtJs/bootstrap.js"></script>
		<script type="text/javascript" src="ExtJs/packages/ext-theme-crisp/build/ext-theme-crisp.js"></script>

    <script type="text/javascript">
			Ext.onReady(function(){
        var panel = new Ext.Panel({
          title: 'SAMPLE',
          renderTo: 'sub1',
          width: '300px',
          html: '<div style="height:160px"></div>'
        });
        var array = [], i;
        for(i=0;i<10;i++){
          array.push(i);
        }
        function fn(item, index, allItems){
          if(item>5){
            return false;
          }else{
            allItems[index] = item + "_st"
          }
        }
        function fn1(item, index, allItems){
          if(index>0)
          return false;
          Ext.Msg.alert("最后的处理结果",
          "<div style='width:160px'>最后的集合为:" + allItems +"</div>");
        }
        Ext.each(array, fn);
        Ext.each(array, fn1);
      });
    </script>
</head>
<body>
<div id=sub1></div>
</body>
</html>

  ExtJs之Ext.each_第1张图片

你可能感兴趣的:(ExtJs之Ext.each)