Yes, using the array method does NOT inform the repeater about the change but, when we re-assign the data provider, the modelChanged event is fired and the repeater will re-draw completely, as will any control that uses a data provider.
I think this is a bug, and you should report it at http://www.macromedia.com/support/email/wishform/ On your other issue, remember that a repeater can repeat a custom component, so if you create a component that presents differently foe different data conditions, you can use that in a repeater. Tracy -----Original Message----- From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Kent Henneuse Sent: Tuesday, June 28, 2005 5:05 PM To: [email protected] Subject: RE: [flexcoders] Confusion with mx:Repeater Cool! I figured somebody would know a way around this. Just to confirm, when the reassignment of the dataProvider is done it will cause the Repeater to redraw/refresh all of its components and sub-components. Hmmm now to find a way to do something similar with disparate types of sub-components so that based on the dataProvider array the creation is different. Thanks, -Kent -----Original Message----- From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Tracy Spratt Sent: Tuesday, June 28, 2005 12:33 PM To: [email protected] Subject: RE: [flexcoders] Confusion with mx:Repeater Interesting. After the removeItemAt call, the next time getRepeaterItem() is called it returns undefined. We might investigate further, but I got this to work by using array methods on the data provider, then re-assigning it to the repeater: for (var i = 0; i < itemList.length; i++) { if (itemList[i].itemId == itemId) { //itemList.removeItemAt(i); itemList.splice(i,1) break; } } items.dataProvider = itemList; Tracy -----Original Message----- From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Kent Henneuse Sent: Tuesday, June 28, 2005 1:25 PM To: [email protected] Subject: [flexcoders] Confusion with mx:Repeater I get the basic concepts of Repeaters and have successfully gotten one to show me one via a dataprovider. I am now having a bit of trouble understanding how to manipulate items in the Repeater. I know that I have to be careful with data in Arrays because they will not fire ChangeEvents but that doesn't seem to be a problem so far. Below is a test screen that I wrote. If I remove the last item first, and then the remaining item it works. If I remove the first item and then try to remove the remaining item, the remaining item is not removed. I am sure this is probably a limited understanding of the calls and use of the Repeater but the documentation seems a bit sketchy on them beyond just for display. Thanks, -Kent <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml"> <mx:Script> <![CDATA[ var itemA = new Object( {itemId:'1', itemText:'Put something in the first box'}); var itemB = new Object( {itemId:'2', itemText:'Put something in the second box'}); var itemList = [itemA, itemB]; public function removeItem(itemId:Number):Void { for (var i = 0; i < itemList.length; i++) { if (itemList[i].itemId == itemId) { itemList.removeItemAt(i); break; } } } ]]> </mx:Script> <mx:Panel title="Items" width="100%"> <mx:Repeater id="items" dataProvider="{itemList}"> <mx:HBox> <mx:TextInput width="90%" text="{items.currentItem.itemText}"/> <mx:Button label="Remove" click="removeItem(event.target.getRepeaterItem(0).itemId)"/> </mx:HBox> <mx:HRule /> </mx:Repeater> </mx:Panel> </mx:Application> I used to work in a fire hydrant factory. You couldn't park anywhere near the place. - Steven Wright -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/

