我想知道如何访问字典中的列表值来总结它们:
vwBottomContainer.addEventListener("click", function(e) {
Ti.API.info('e.source.id: ' + e.source.id);
if (e.source.id == "CheckBox") {
if (e.source.status == "unselected") {
e.source.status = "selected";
e.source.image = "/images/checked.png";
} else {
e.source.status = "unselected";
e.source.image = "/images/unchecked.png";
}
} else if (e.source.id == "TextBox") {
e.source.editable = true;
e.source.focus();
} else if(e.source.id == "radiobutton") {
var t = null;
for(t = 0 ; t < e.source.parent.parent.children.length; t++) {
e.source.parent.parent.children[t].children[0].image = "/images/radio-button_ori.png";
e.source.parent.parent.children[t].children[0].status = "unselected";
Ti.API.info('e.source: '+JSON.stringify(e.source.parent.parent.children[t].children[0]));
}
t = null;
e.source.image = "/images/radio-button_active.png";
e.source.status = "selected";
}
});
我想总结每个列表总和的第一个元素(3,0,57492,1)。
是否可以在没有任何循环的情况下这样做?
提前谢谢