Solved

List control to change dataprovider on a TileList

Posted on 2009-04-15
4
459 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_
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

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…
Learn to move / copy / export exchange contacts to iPhone without using any software. Also see the issues in configuration of exchange with iPhone to migrate contacts.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

743 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

18 Experts available now in Live!

Get 1:1 Help Now