Solved

List control to change dataprovider on a TileList

Posted on 2009-04-15
4
465 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

SuperAntiSpyware Licenses Discounted by 25% !

Exclusive offer to Experts Exchange Members!
Buy SuperAntiSpyware License(s) from us and save 25% on the regular purchase price.
- Includes Full SuperAntiSpyware Vendor Support Entitlements
- Your Subscription does not begin until you activate your license
- Buy for your friends

Question has a verified solution.

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

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…
Recently I was talking with Tim Sharp, one of my colleagues from our Technical Account Manager team about MongoDB’s scalability. While doing some quick training with some of the Percona team, Tim brought something to my attention...
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

710 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