This is an automated email from the ASF dual-hosted git repository.

yishayw pushed a commit to branch add_location_to_update_events
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git

commit 298143f5313c75216bb2d4a51cc3320de19f1e7e
Author: yweiss <[email protected]>
AuthorDate: Wed Jun 1 04:04:56 2022 -0700

    Add location to update events
---
 .../src/main/royale/mx/collections/ListCollectionView.as          | 8 ++++++++
 .../MXRoyaleBase/src/main/royale/mx/collections/XMLListAdapter.as | 8 ++++++++
 2 files changed, 16 insertions(+)

diff --git 
a/frameworks/projects/MXRoyaleBase/src/main/royale/mx/collections/ListCollectionView.as
 
b/frameworks/projects/MXRoyaleBase/src/main/royale/mx/collections/ListCollectionView.as
index d6c8bd5265..4580d871e8 100644
--- 
a/frameworks/projects/MXRoyaleBase/src/main/royale/mx/collections/ListCollectionView.as
+++ 
b/frameworks/projects/MXRoyaleBase/src/main/royale/mx/collections/ListCollectionView.as
@@ -1625,6 +1625,14 @@ public class ListCollectionView extends Proxy implements 
ICollectionView, IList
             var updateEvent:CollectionEvent = new 
CollectionEvent(CollectionEvent.COLLECTION_CHANGE);
             updateEvent.kind = CollectionEventKind.UPDATE;
             updateEvent.items = eventItems;
+            for (i = 0; i < list.length; i++)
+            {
+                if (list.getItemAt(i) == (eventItems[0] as 
PropertyChangeEvent).source)
+                {
+                    updateEvent.location = i;
+                    break;
+                }
+            }
             dispatchEvent(updateEvent);
         }
     }
diff --git 
a/frameworks/projects/MXRoyaleBase/src/main/royale/mx/collections/XMLListAdapter.as
 
b/frameworks/projects/MXRoyaleBase/src/main/royale/mx/collections/XMLListAdapter.as
index 5a991ca7a8..e1557472a2 100644
--- 
a/frameworks/projects/MXRoyaleBase/src/main/royale/mx/collections/XMLListAdapter.as
+++ 
b/frameworks/projects/MXRoyaleBase/src/main/royale/mx/collections/XMLListAdapter.as
@@ -655,6 +655,14 @@ public class XMLListAdapter extends EventDispatcher 
implements IList, IXMLNotifi
                                new 
CollectionEvent(CollectionEvent.COLLECTION_CHANGE);
                updateEvent.kind = CollectionEventKind.UPDATE;
                updateEvent.items.push(event);
+            for (var i:int = 0; i < source.length(); i++)
+            {
+                if (source[i] == event.source)
+                {
+                    updateEvent.location = i;
+                    break;
+                }
+            }
                dispatchEvent(updateEvent);
            }
     }

Reply via email to