Bonjour à tous,
J'affiche à l'écran des éléments grâce à une ArrayCollection. Ces éléments peuvent être ajoutés, modifiés, supprimés tandis que l'affichage reste synchronisé. Ça, ça fonctionnait.
Sauf que depuis que j'ai mis un Sort à la liste, rien ne va plus !
Voici des extraits de mon code :Error: No items to search.
at mx.collections::Sort/findItem()
at mx.collections::ListCollectionView/getItemIndex()
at com.xxx.notariat.tiers.main.components.abstracts::AbstractTiersEnregistrementBox/supprimerItemRepresentants()
at com.xxx.notariat.tiers.main.components.helpers:opUpButtonMenuHandler/clickHandler()
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at mx.core::UIComponent/dispatchEvent()
at mx.controls::Menu/dispatchEvent()
at mx.controls::Menu/mouseUpHandler()
Quelqu'un peut-il me dire comment sortir de l'impasse, SVP ?
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26 ... protected var _listeRepresentants:ArrayCollection = new ArrayCollection(); ... public function AbstractTiersEnregistrementBox():void { super(); ... this.addEventListener(FlexEvent.CREATION_COMPLETE, init); } private function init(event:Event):void { var principalSorter:SortField = new SortField("principal"); var nomSorter:SortField = new SortField("nom", true); var arraySorter:Sort = new Sort(); arraySorter.fields = [principalSorter, nomSorter]; _listeRepresentants.sort = arraySorter; } ... [Bindable] public function get listeRepresentants():ArrayCollection { return _listeRepresentants; // le tri est configuré dans #init } public function supprimerItemRepresentants(tiers:Tiers):void { var index:int = _listeRepresentants.getItemIndex(tiers); _listeRepresentants.removeItemAt(index); }
Merci (beaucoup) d'avance.
Partager