PDA

View Full Version : Lists within lists???


loki421
07-05-2009, 03:05 PM
Hi all :)

I have a little problem, i have a list control that displays items from my database, and i'm using an item renderer to display in the list. In that item renderer i have another list that displays sub items of the previous list (if that makes sence?) and then a final itemRenderer within that one!

here's the code for the first list:


<mx:List dataProvider="{myData}"
id="listTesting"
itemRenderer="views.subListView"
themeColor="#FFFFFF"
borderStyle="none"
paddingRight="10"
columnWidth="590" right="0" top="30"
variableRowHeight="true"
rowCount="{listTesting.dataProvider.length}"
left="18" bottom="0" />


And that displays everything fine, then i have this itemRenderer:

<mx:Canvas width="100%" horizontalScrollPolicy="off" verticalScrollPolicy="off" height="100%">
<mx:List id="subListDisplay"
dataProvider="{mySubData}"
itemRenderer="views.finalDisplay"
borderStyle="none"
change="getDetails(event)"
click="getDetails(event)"
rowCount="{subListDisplay.dataProvider.length}"
right="0" top="0" left="0" >
</mx:List>
</mx:Canvas>


And then I have a single canvas as an itemRenderer that shows the info.

Problem is i can't seem to access the final itemRenderer, everything shows fine with all the correct data, but I cannot select anything.

I've tried putting a 'change' function on every list right down to the itemRenderer one at a time and nothing happens!

I'm just trying to show an alert at the moment so that i know that the item has been clicked, but wherever i put the alert it doesn't register, so therefore i can't bring up the details of the selected item.

Should i just use a repeater first and then a list, or a list first with the sub data in a repeater within the itemRenderer? Or is there a way to access the item that i've clicked from another fuvtion other than 'change'? (I've already tried 'click' on all three seperatly)

Surly it shouldn't be this hard to 'burrow' down through the lists and have the click/change event register?

Any help would be gratefully recieved as always :D

Many thanks in advance!

nikos101
09-22-2009, 01:16 PM
In your bottommost render get it to fire a custom event that is heard by your application and then act apon that.