這里要查詢一個一個Repeater中嵌套的一個Repeater的Image中的圖片是什么. 從而進行屬性操作. 要注意的就是普通控件獲取children后, 用[]下標即可操作子元素, Repeater要用itemAt函數操作子元素.
for(var i = 0; i < items; ++i)
{
console.log("lineRep["+ i + "] id = ", lineRep.itemAt(i)) //打印出子控件的類型
var childItems = lineRep.itemAt(i).children
console.log(" childitems count : " + childItems.length)
//第二段是我需要的, 所以這里沒有遍歷, 直接設置j = 1的.
var j = 1
console.log(" childItems["+ j + "] id = ", childItems[j]) //打印出子控件的類型
var grandChidlItems = childItems[j].children
var childRepC = grandChidlItems[2].count
console.log(" childRep count = " + childRepC)
for(var k = 0; k < childRepC; ++k)
{
console.log(" childRepson[" + k + "] id = ", grandChidlItems[2].itemAt(k)) //打印出子控件的類型
var childRepSons = grandChidlItems[2].itemAt(k).children
console.log(" childRepSons count = ", childRepSons.length)
for(var l in childRepSons)
{
console.log(" childRepSons["+ l + "] id = ", childRepSons[l]) //打印出子控件的類型
console.log(" childRepSonsSon[" + l + "] source = ", childRepSons[l].source) //達到目標, 獲取到了圖片的名稱.
}
}
}