Solved

List control to change dataprovider on a TileList

Posted on 2009-04-15
4
460 Views
Last Modified: 2012-05-06
I have a list control populated via xml and when you click one of the items in the list, I'd like to change the dataprovider on a tilelist based on that selection.  The dataproviders for the tilelist would be xmllistcollections.  So I guess I'd have several XMLListCollections and then the dataProvider for the tileList would need to be dynamic?  And could the dataProvider somehow be defined in the xml for the list control?
0
Comment
Question by:moglie
  • 2
4 Comments
 
LVL 5

Expert Comment

by:Fuzzy_Logic_
ID: 24150149
There are a few ways you could do this.

I would have a function that gets a new XMLListCollection based on a url. Then reference that xml address in the xml file that builds your main TileList.

Then in the main TileList capture the click event and point it to the function that gets a new XMlListCollection. Once the XMlListColleciton is loaded, point the dataProvider for your 'sub'TileList in the direction of your newXMLListCollection.
0
 

Author Comment

by:moglie
ID: 24150559
This is what I have so far.  Of course it's not fully working.

                  private function changeHandler(evt:Event):void {                        
                         categoryTile.dataProvider = evt.currentTarget.selectedItem.provider;
                   }  

and then a few xmllistcollections:

      <mx:XML id="xml1" source="gallery.xml"/>
      <mx:XMLListCollection id="xmlListCol1l" source="{xml.image}"/>  

       <mx:XML id="xml2" source="gallery.xml"/>
      <mx:XMLListCollection id="xmlListColl2" source="{xml.image}"/>

       <mx:XML id="xml3" source="gallery.xml"/>
      <mx:XMLListCollection id="xmlListColl3" source="{xml.image}"/>

and then the xml:

<root>
      <categories>
            <name>Adjusting to War Memroies</name>
            <provider>xmlListColl1</provider>
      </categories>
      <categories>
            <name>Dealing With Depression</name>
            <provider>xmlListColl2</provider>
      </categories>
      <categories>
            <name>Handling Stress</name>
            <provider>xmlListColl3</provider>
      </categories>
</root>
0
 

Author Comment

by:moglie
ID: 24153479
Just for testing, if I directly assign a specific dataProvider in the function, it will obviously populate the tilelist with that data.  But can I use the provider node in the list control xml to essentially assign an xmllistcollection dp?

                  private function changeHandler(evt:Event):void {
                        categoryTile.dataProvider = xmlListColl;

                   }      

This just isn't working
 

categoryTile.dataProvider = evt.currentTarget.selectedItem.provider;

Open in new window

0
 
LVL 12

Accepted Solution

by:
lexxwern earned 500 total points
ID: 24154460
Try this:
<?xml version="1.0" encoding="utf-8"?>

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="horizontal">

	

	<mx:List id="list" width="30%" height="100%" labelField="@label">

		<mx:dataProvider>

			<mx:XMLListCollection>

				<mx:source>

					<mx:XMLList xmlns="">

						<node label="1">

							<node label="1.1"/>

							<node label="1.2"/>

							<node label="1.3"/>

						</node>

						<node label="2">

							<node label="2.1"/>

							<node label="2.2"/>

							<node label="2.3"/>

						</node>

						<node label="3">

							<node label="3.1"/>

							<node label="3.2"/>

							<node label="3.3"/>							

						</node>

					</mx:XMLList>

				</mx:source>

			</mx:XMLListCollection>

		</mx:dataProvider>

	</mx:List>

	

	<mx:TileList id="tileList" width="70%" height="100%" dataProvider="{XMLList(XML(list.selectedItem).node)}" 

            maxColumns="2" rowHeight="225" columnWidth="125" labelField="@label">

		

	</mx:TileList>

	

</mx:Application>

Open in new window

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Flex GroupingCollection2 with Multiple GroupingFields 3 821
LinkList not supported? 8 294
Adobe URL is default to local hosts in my Mac Air 13 536
Running Guacamole on port 80 5 153
First things first - Preparation We need all the part for this install and it's much nicer to have them all on hand when you need them so here's what's required. Download Eclipse 3.5 32 bit (I like the Classic flavour) from here. (http://www.e…
Scenario: Your operations manager has discovered an anomaly in your security system. The business will start to suffer within 15 minutes if it is a major IT incident. What should she do? We have 6 recommendations for managing major incidents (https:…
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now