- Thanks
the last oneOn 11/3/06, Jaime Bermudez < [EMAIL PROTECTED]> wrote:What version of the Flex 2 SDK are you running Igor?
On 11/3/06, Igor Costa < [EMAIL PROTECTED]> wrote:I see each parent node with their subnodes for each of them.
Regards.On 11/3/06, Jaime Bermudez < [EMAIL PROTECTED]> wrote:Try this:
1) Add a parent node by clicking the button in lower right-hand corner
2) Add a second parent node
3) Add a child to the first parent node
When I do this, I see that the child was added to both the first AND second parent nodes. What do you see?On 11/3/06, Igor Costa < [EMAIL PROTECTED]> wrote:I didn't have this problem Jaime.
It's works for me.On 11/3/06, Jaime Bermudez < [EMAIL PROTECTED] > wrote:Hmmm, not sure what you mean Igor. Can you not get the app to compile or run for you? I just tested moving the script block up to the top on my machine and it still runs. Anyone else having issues running this sample app?
On 11/3/06, Igor Costa < [EMAIL PROTECTED]> wrote:Jaime I just tested your code and I saw that if you put the mx:script tag after your usage of implementation doesn't work.--
Just try this one.
<?xml version="1.0" encoding="utf-8"?>
<mx:Application
xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute"
width="100%"
height="100%"
creationComplete="init()"
><mx:Script></mx:Application>
<![CDATA[
import mx.collections.ArrayCollection;
import mx.core.UIComponent;
[Bindable]
public var dpParent:ArrayCollection;
public function init() : void
{
dpParent = new ArrayCollection();
}
public function handleAddParentClick():void
{
var newParent:Object = new Object();
newParent.name = "Parent number " + ( dpParent.length + 1);
newParent.children = new ArrayCollection();
this.dpParent.addItem(newParent);
}
public function handleAddChildClick(event:MouseEvent):void
{
var parent:Object = UIComponent( event.currentTarget).getRepeaterItem();
var newChild:Object = new Object();
newChild.name = "Child number " + (ArrayCollection(parent.children).length + 1);
ArrayCollection(parent.children ).addItem(newChild);
}
]]>
</mx:Script>
<mx:Panel id="main"
width="100%"
height="100%"
title="Testing representing complex structure in nested repeater"
>
<mx:Repeater id="rpParents"
dataProvider="{this.dpParent}">
<mx:HBox width="100%">
<mx:Text id="txtParentName"
width="100%"
paddingLeft="100"
text="{rpParents.currentItem.name }"
/>
<mx:Button id="btnAddChild"
label="Add a child to this parent node"
click="this.handleAddChildClick(event);"
/>
</mx:HBox>
<mx:Repeater id="rpChildren"
dataProvider="{ rpParents.currentItem.children}"
>
<mx:Text id="txtChildName"
width="100%"
paddingLeft="200"
text="{ rpChildren.currentItem.name}"
/>
</mx:Repeater>
</mx:Repeater>
<mx:ControlBar
width="100%"
horizontalAlign="right">
<mx:Button id="btnClearParents"
label="Clear all parents"
click="this.dpParent = new ArrayCollection();"
/>
<mx:Button id="btnAddParentNode"
label="Add a new parent node"
click="handleAddParentClick();"
/>
</mx:ControlBar>
</mx:Panel>
Regards
On 11/2/06, Jaime Bermudez <[EMAIL PROTECTED] > wrote:Hi flexcoders,I've come across a potential bug in an app I'm working on, but perhaps I'm doing something wrong. I have an array of VOs where each VO has an array of children VOs. I'm using a nested repeater to represent this structure. The user can add parents and children - this is when some strange behavior occurs. Some repeater rows in the nested repeater appear blank. I tried the whole dummy UI object filler to no avail. Here's a sample app that illustrates the problem. Just add a few parents and then add children and you'll see a lot of repeated rows. Any help would be appreciated:<?xml version="1.0" encoding="utf-8"?>
<mx:Application
xmlns:mx=" http://www.adobe.com/2006/mxml"
layout="absolute"
width="100%"
height="100%"
creationComplete="init()"
>
<mx:Panel id="main"
width="100%"
height="100%"
title="Testing representing complex structure in nested repeater"
>
<mx:Repeater id="rpParents"
dataProvider="{this.dpParent}">
<mx:HBox width="100%">
<mx:Text id="txtParentName"
width="100%"
paddingLeft="100"
text="{rpParents.currentItem.name }"
/>
<mx:Button id="btnAddChild"
label="Add a child to this parent node"
click="this.handleAddChildClick(event);"
/>
</mx:HBox>
<mx:Repeater id="rpChildren"
dataProvider="{ rpParents.currentItem.children}"
>
<mx:Text id="txtChildName"
width="100%"
paddingLeft="200"
text="{ rpChildren.currentItem.name}"
/>
</mx:Repeater>
</mx:Repeater>
<mx:ControlBar
width="100%"
horizontalAlign="right">
<mx:Button id="btnClearParents"
label="Clear all parents"
click="this.dpParent = new ArrayCollection();"
/>
<mx:Button id="btnAddParentNode"
label="Add a new parent node"
click="handleAddParentClick();"
/>
</mx:ControlBar>
</mx:Panel>
<mx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
import mx.core.UIComponent;
[Bindable]
public var dpParent:ArrayCollection;public function init() : void
{
dpParent = new ArrayCollection();
}
public function handleAddParentClick():void
{
var newParent:Object = new Object();
newParent.name = "Parent number " + (dpParent.length + 1);
newParent.children = new ArrayCollection();
this.dpParent.addItem(newParent);
}
public function handleAddChildClick(event:MouseEvent):void
{
var parent:Object = UIComponent(event.currentTarget).getRepeaterItem();
var newChild:Object = new Object();
newChild.name = "Child number " + (ArrayCollection(parent.children).length + 1);
ArrayCollection(parent.children).addItem(newChild);
}
]]>
</mx:Script>
</mx:Application>
Thanks,
Jaime
----------------------------
Igor Costa
www.igorcosta.com
--
----------------------------
Igor Costa
www.igorcosta.com
--
----------------------------
Igor Costa
www.igorcosta.com
--
----------------------------
Igor Costa
www.igorcosta.com
__._,_.___
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
Software development tool | Software development | Software development services |
Home design software | Software development company |
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe
__,_._,___