ExtJS 遍历集合

<script type="text/javascript">
Ext.onReady(function() {
var panel = new Ext.Panel({
title : '集合调用Ext.each的处理',
renderTo : Ext.getBody(),
width : '280px',
html : "<div style='height:160px'></div>"
});
/**
遍历集合
*/
var array = [], i;//定义一个集合
for (i = 0; i < 10; i++) {//为集合添加元素
Ext.Msg.alert('','pushs');
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>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值