Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8372289
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T14:23:30+00:00 2026-06-09T14:23:30+00:00

On one PC, I have a datagrid with dataprovider being an arraycollection populated by

  • 0

On one PC, I have a datagrid with dataprovider being an arraycollection populated by a collection of records retrieved from MySQL DB. On another PC, another component retrieve the same collection of records and update them. Instanly, the datagrid in PC one reflected the changes that were made in PC two which is nice because it pushes the changes to all affected controls online. However, I want to detect the the arraycollection changes to do some other things but such CollectionEvent.COLLECTION_CHANGE is not detected. Can you help please? Here is the code:

protected function doInit():void
{
acLeave.addEventListener(CollectionEvent.COLLECTION_CHANGE, onAcLeaveChange);
}

protected function onAcLeaveChange(event:CollectionEvent):void
{
do something
}

I am using lcds and the data management service handled the data synchronization already. That is why the first pc with the data grid data provider acLeave changed automatically. Somehow it is because lcds knows there is a client (pc one) online, then it pushes the changes to it. My question is that the datagrid data changed, I want to detect there is a data change occur so that I can do some other updates. Normally, to detect datagrid change, I can use datagrid datachange or simply addlistener to the data provider for collectionEvent.COLLECTION_CHANGE but in this case even though I can see the ac acLeave changed, the event did not fire. Please help!

Hi, me again and thanks for your advise. I have added the setter to acLeave but still unable to listen the collectionEvent change. Here is the modified code:

private var _acLeave:ArrayCollection = new ArrayCollection();

[Bindable]
public function get acLeave():ArrayCollection
{
    return _acLeave;
}
public function set acLeave(value:ArrayCollection):void
{
    _acLeave = value;
}
protected function doInit():void
{
    acLeave.addEventListener(CollectionEvent.COLLECTION_CHANGE, onAcChange);
}

protected function dataGrid_creationCompleteHandler(event:FlexEvent):void
{
    getAllResult.token = leaverequestService.getAll();
    getAllResult.addEventListener(ResultEvent.RESULT, onGotResult);
}

protected function onGotResult(event:ResultEvent):void
{
    acLeave = getAllResult.lastResult;
}

protected function onAcChange(event:CollectionEvent):void
{
    // this never executed because unable to detect a change on acLeave
    Alert.show("acLeave Changed !");
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T14:23:31+00:00Added an answer on June 9, 2026 at 2:23 pm

    If your collection change handler is not firing, I am guessing something like this is happening:

    • pc1 adds collection change listener
    • pc2 changes the collection
    • LCDS sends pc1 a brand new ArrayCollection object (not just the element that changed) to use

    The original ArrayCollection you are listening for the collectionChange is not necessarily getting changed, it is getting replaced. So no collection change event ocurrs.

    If you add a setter method for this ArrayCollection (acLeave in your example), then you will know if this ever happens. Technically, you should use both the collection change event and this setter to be able to detect all the cases when the array could be changed.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a DataGrid, populated with objects in an ArrayCollection. After updating one of
I have a DataGrid in Flex, with one column a checkbox and another a
I have a Datagrid thats being populated by different Arrays... (headers/columns change for the
I am using MVVM pattern and I have one DataGrid with a column which
I have a DataGrid that is showing some data via a PagedCollectionView with one
I have a Dojo Datagrid in one of my pages (which contains more content)
We have a Flex DataGrid with 3 columns of which one of them has
The situation is simple. I have a datagrid that gets its data from a
I'm using a custom component CheckBoxList DataGrid ( http://blogs.adobe.com/aharui/2008/02/checkbox_selection_in_datagrid.html ) and as dataProvider I
I have a DataGrid (the official one) with SelectionUnit=Cell . When the user selects

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.