Flex 3:关于转发器的条件语句的问题
我有一个 xml 文件,其中包含项目的开始日期和长度...我使用中继器来加载每个项目。用户的屏幕一次只显示两周。我想这样做,如果一个项目在两周内没有出现在屏幕上,则该项目不会被加载。我可以通过对 XML 进行排序并找到要加载的正确项目并将它们放入数组集合中来完成此操作,但是有一个“移动日期”按钮允许用户更改显示的两周。一旦更改了两周,我就需要展示适合新的两周窗口的项目。
目前,我的中继器看起来像这样:
<mx:Repeater id="projectRP" dataProvider="{projectsHttp.lastResult.project}" recycleChildren="true">
<Block:project id="wholeProject"
dbID="{Number(projectRP.currentItem.dbID)}"
projectID="{projectRP.currentIndex}"
workingTitle="{projectRP.currentItem.workingTitle}"
projectTitle="{projectRP.currentItem.projName}"
startDate="{textToDate(projectRP.currentItem.startDate)}"
projectPositions="{XML(projectRP.currentItem.positions)}"
/>
</mx:Repeater>
任何帮助将不胜感激!
I have an xml file that has a start date and length of a project... I use a repeater to load each project. The users' screen only shows 2 weeks at a time. I would like to make it so that if a project doesn't fall within the two weeks on screen, that the project isn't loaded. I could do this by sorting through the XML and finding the correct projects to load, and putting them into an array collection, but there's a "move date" button which allows the user to change the two weeks that are showed. Once the two weeks are changed, I would need the projects that fit into that new 2 week window to show.
Currently, my repeater looks like this:
<mx:Repeater id="projectRP" dataProvider="{projectsHttp.lastResult.project}" recycleChildren="true">
<Block:project id="wholeProject"
dbID="{Number(projectRP.currentItem.dbID)}"
projectID="{projectRP.currentIndex}"
workingTitle="{projectRP.currentItem.workingTitle}"
projectTitle="{projectRP.currentItem.projName}"
startDate="{textToDate(projectRP.currentItem.startDate)}"
projectPositions="{XML(projectRP.currentItem.positions)}"
/>
</mx:Repeater>
Any help would be greatly appreciated!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您无法使用中继器来做到这一点,而且我相信我们之前已经多次告诉过您不要使用中继器。如果有的话,过滤数据并执行项目的运行时添加或使用某种列表。
如果您使用列表,过滤器将自动工作。如果您使用运行时添加,则需要侦听 ArrayCollection 上的集合更改事件并执行您自己的算法。
You can't do this with a repeater, and I believe we've told you several times before not to use a repeater. If anything, filter the data and either do runtime adding of the project or use a List of some sort.
If you're using a List, filter would work automatically. If you're using runtime adding, you'll need to listen for the collection change event on the ArrayCollection and do your own algorithm.