Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

List control to change dataprovider on a TileList

Posted on 2009-04-15
4
Medium Priority
?
469 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 1500 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

Better audio for more successful meetings

Challenge: S&ME was tired of poor audio quality of Skype for Business calls in mid-sized meeting and training rooms. They were looking for a reliable and cost efficient solution to replace the existing conferencing system.

Question has a verified solution.

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

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…
What we learned in Webroot's webinar on multi-vector protection.
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

715 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