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

  • SEARCH
  • Home
  • 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 8984875
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T21:12:42+00:00 2026-06-15T21:12:42+00:00

In flex , I’m using a component which displays a specific item (selectedItem field)

  • 0

In flex, I’m using a component which displays a specific item (selectedItem field) from its dataProvider (ListCollectionView).

The elements of my dataProvider can be edited by different means. Each time one is edited, an update event is sent, leading to update the dataProvider collection (ListCollectionView::listChangeHandler).

In the process, if my selectedItem is the edited element, it is erased (set to null via the ListCollectionView::moveItemInView), even if the edited field is used nowhere.

Is there a way to avoid this ?

More specifically without having to save it before, having it lost and restoring it afterwards (which would be hardly practicable here)


Edit :
Okay, I think I can explain further :

In my code, I make an affectation on a property of one of the items of the list which is databinded to the dataProvider.
I don’t know exactly why, probably because the class of the item is [bindable], this throws an update event.

This event is caught by the ArrayList::itemUpdateHandler which dispatches it to the ListCollectionView::listChangeHandler.
At this point, the event “kind” is “update”, which seems ok to me…

But from there, it goes to ListCollectionView::moveItemInView (I suppose that it makes sens as the item should have to update its position if the list is sorted).
This function removes the item from it’s former location and added it to its new location.

As it removes it, it sends a new Event with “remove” kind.
And this is where the thing goes wrong : my component listens the remove events of the data it uses and removes its selectedItem if this element is removed.

I think it is around the call to moveItemInView that there is a problem :
the call in ListCollectionView::handlePropertyChangeEvents (called by listChangeHandler) is :
moveItemInView(updateEntry.item, updateEntry.item, eventItems);
(where updateEntry.item is the modified item of the list and eventItems an empty array)

Whereas its prototype is :
private function moveItemInView(item:Object, dispatch:Boolean = true, updateEventItems:Array = null):void

Is that a bug ?

  • 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-15T21:12:43+00:00Added an answer on June 15, 2026 at 9:12 pm

    How do you update the dataProvider? If it is this

    list.dataProvider = newDataProvider
    

    Then the behavior you see is expected. From the List perspective, you have completely replaced the dataProvider and the List has no way of knowing if the old selectedItem/selectedIndex will still be valid. I think it makes the correct assumption in assuming that it is not.

    Or do you update the dataProvider using the dataProvider’s refresh method:

    list.dataProvider.refresh();
    

    In such a case the dataProvider’s length could change; as could its elements. In this case a collectionChange event will be dispatched and the list should have a method to handle the collectionChange event. The List has no way to know whether the previous selected item will be in the new list; whether its index will change, or even if the old selectedIndex will still be valid. So, the selectedItem gets reset.

    Generally to preserve the selectedItem/selectedIndex in either case, you should store a reference to it and reset it after the dataProvider change:

    mySelectedItem = list.dataProvider.selectedItem;
    // update dataProvider Here
    list.dataProvider.selectedItem = mySelectedItem;
    

    If you’re just updating an item in the dataProvider; then the selectedIndex/selectedItem should not be affected.

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

Sidebar

Related Questions

Our flex project, which works fine in its current environment with coldfusion 7 single
Using Flex 3.2, I have a object which extends a TitleWindow. In this TitleWindow
In flex 4 I'm using a PopUpButton with a Menu populated with records from
(Flex 3) I have a TextArea component which needs to hold the user's clipboard
Using Flex 3, I have a Button which is skinned using PNGs specified in
Using Flex 3, I would like to take an image snapshot such as this:
Using Flex and Bison, I have a grammar specification for a boolean query language,
Flex has the SoundMixer.computeSpectrum function that lets you compute an FFT from the currently
[FLEX 4 / AS3] I load a new component in a as3 file and
in Flex 3.2 Having troubles converting remote object result to specific object on client

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.