Reputation: 1631
I also post the question on flex community.
The issue is when List dataProvider has ISort property, after change the removed item property and refresh the ArrayCollection, even set list.selectedIndex = -1, the List still has one item selected.
Before remove "43" item:
After remove the "43" item, auto select first item(what I want is the list has no selected item and no caret item):
Upvotes: 0
Views: 47
Reputation: 1631
I found a workaround. Remove the items then change property.
Modify the function as following:
private function removeLast():void {
var lastItem:Object = _dataProvider.getItemAt(_dataProvider.length -1);
//remove the item
_dataProvider.removeItemAt(_dataProvider.getItemIndex(lastItem));
// then change property
lastItem.digit = -100;
// Note: MUST refresh
_dataProvider.refresh();
// do other stuff
list.selectedIndices = new Vector.<int>();
list.selectedIndex = -1;
}
Upvotes: 0