0

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!

Brds
  • 1,035
  • 3
  • 17
  • 37

1 Answers1

0

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.

J_A_X
  • 12,857
  • 1
  • 25
  • 31
  • What can I use instead of a repeater? – Brds Jul 12 '11 at 15:27
  • List or your own custom container, as mentioned in my answer. – J_A_X Jul 12 '11 at 15:33
  • Do you think you could do me a solid and provide an example? I tried google for one, but came up empty handed – Brds Jul 12 '11 at 15:35
  • is there a reason you can't use List? – J_A_X Jul 12 '11 at 15:39
  • I just can't find any examples of where using list will achieve the same results as using repeater does – Brds Jul 12 '11 at 15:41
  • And what are the results you're looking for? – J_A_X Jul 12 '11 at 15:43
  • To be able to send data from my xml file to a child component. – Brds Jul 12 '11 at 17:05
  • That's an implementation, not a result. What behavior are you trying to accomplish? – J_A_X Jul 12 '11 at 17:07
  • if you look at http://tinyuploader.com/images/schedulerl.gif... the blue area is called a project. I need to take my xml data, feed it into something (I currently have a repeater... but apparently that's not the way to go) and have the project module handle the data. – Brds Jul 12 '11 at 17:12
  • Yeah, you'll need to use your own custom component for that. I would create a custom component that extends Canvas (that would be for your 'schedule' background) and have a public property of 'dataProvider' which would be the data you provide in an ArrayCollection. In the setting, remove old listener and add new listener for the collection change event which would redraw your schedule and recycle your 'item renderers' (projects) by using a pool. I won't give you the implementation, but I just gave you a direction and a lot of things to read up on :) – J_A_X Jul 12 '11 at 17:18