开发者

Flex 3: creationComplete alert in repeater... question about getting repeater.currentIndex

I have a repeater to call a child... my code is as follows:

<mx:Repeater id="projectRP" dataProvider="{projectsHttp.lastResult.project}">
    <Block:project id="wholeProject"
        projectID="{projectRP.currentIndex}"
        workingTitle="{projectRP.currentItem.workingTitle}"
        projectTitle="{projectRP.currentItem.projName}"
        startDate="{textToDate(projectRP.currentItem.startDate)}"
        projectPositions="{XML(projectRP.currentItem.positions)}"
        creationComplete="Alert.show(String(projectRP.currentIndex))"
    />
</mx:Repeater开发者_开发技巧>

For some reason, the creationComplete piece isn't s


By the time creationComplete is called, currentIndex is no longer the current index.

To get info from the item, you can pass the event to a creationcomplete handler and figure out the index somwhere in there. If your dataprovider is a collection you can do this:

Alert.show(projectsHttp.lastResult.project.getItemIndex(event.currentTarget.getRepeaterItem()).toString())

But if it's not a collection with getItemIndex function you'll have to do a loop I think. Maybe the index is somewhere in the event.currentTarget... so maybe through a debug point and take a look for it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜