I suppose we should have called it "queueUpUpdatesUntilLater" and "sendAllQueuedUpUpdatees".
IMHO, there's an upper limit where, instead of changing piecemeal, you should just set a new source, which should just send one big RESET event. ________________________________ From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of t0ml33 Sent: Wednesday, November 21, 2007 11:58 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] ListCollectionView dispatches too many CollectionEvents after enableAutoUpdate I am making some updates to an ArrayCollection. Since it's the dataSource for a DataGrid, and I want the binding to update as few times as possible, I am using ArrayCollection.disableAutoUpdate(), making the changes, and then calling enableAutoUpdate() thinking that this will cause the binding to refresh only once for all the changes. This would be the case if the ArrayCollection were dispatching events of kind CollectionEventKind.UPDATE. Alas, since I am replacing the items in the ArrayCollection and not merely updating them, it is CollectionEventKind.REPLACE. As you can see from handlePendingUpdates() in ListCollectionView, it only gangs the updates into a single refresh if the event.kind == CollectionEventKind.UPDATE. All other CollectionEvents are fired sequentially, which would seem to defeat the purpose of disableAutoUpdate. Could someone clue me in on why this should be the case? I'm tempted to monkey-patch around it, and submit a bug. See the code below. Thanks, -tom private function handlePendingUpdates():void { if (pendingUpdates) { var pu:Array = pendingUpdates; pendingUpdates = null; // Could further optimize to consolidate various events // and make a decision if there are too many updates // and we should just refresh. var singleUpdateEvent:CollectionEvent; for (var i:int = 0; i < pu.length; i++) { var event:CollectionEvent = pu[i]; // ****** Here's the offending code if (event.kind == CollectionEventKind.UPDATE) { if (!singleUpdateEvent) { singleUpdateEvent = event; } else { for (var j:int = 0; j < event.items.length; j++) { singleUpdateEvent.items.push(event.items [j]); } } } else { listChangeHandler(event); } } if (singleUpdateEvent) { listChangeHandler(singleUpdateEvent); } } }