[ https://issues.apache.org/jira/browse/FLEX-23974?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Mark Kessler resolved FLEX-23974. --------------------------------- Resolution: Fixed The itemRenderers were not updated immediately following a dataProvider refresh. Forced them to be using a validateNow just prior to the selectitem that uses the itemRenderer to resolve it's index. Successfully built SDK, passed datagrid mustella. > Datagrid with ArrayCollection provider, error at setter of selectedIndex > after applying filters to the ArrayCollection > ---------------------------------------------------------------------------------------------------------------------- > > Key: FLEX-23974 > URL: https://issues.apache.org/jira/browse/FLEX-23974 > Project: Apache Flex > Issue Type: Bug > Components: mx: DataGrid > Affects Versions: Adobe Flex SDK 3.2 (Release) > Environment: Affected OS(s): Windows > Affected OS(s): > Browser: Firefox 3.x > Language Found: English > Reporter: Adobe JIRA > Assignee: Mark Kessler > > Steps to reproduce: > 1. Create a DataGrid with DataProvider an ArrayCollection > 2. Full the ArrayCollection with N items > 3. Apply a filter to the ArrayCollection that only one item is shown (not in > position 0) > 4. set the datagrid selectedIndex to 0 > > Actual Results: > the datagrid selectionIndex is set to the last known position of the item > instead to 0 > > > Expected Results: > datagrid selectionIndex = 0 > > > Workaround (if any): > After Applying the filters to the arrayCollection use > datagrid.validateNow(); before settin selectionIndex to 0 > > > ------ > Information found when debugging the flex api. > DATAGRID BEFORE APPLYING FILTERS > * SPAIN > * CARTAGO > * AMERICA > * AUSTRALIA > filter: name cotains "RAL" > DATAGRID AFTER APPLYING FILTERS > * AUSTRALIA > the piece of code: > ------- > acResultats.filterFunction = componentFiltre.objectBelongFilters; > acResultats.refresh(); > if(acResultatsFiltrats.length > 0){ > //datagrid_id.validateNow(); <-- Uncomment this to allow the app to > work fine > datagrid_id.selectedIndex = 0; > itemClicked(); > } > ------- > When debugging the line datagrid_id.selectedIndex = 0; the collection > attribute is correctly set to only 1 element in the array and the length set > to 1. So it follow the code road: > * selectedIndex = 0 > ---> commitSelectedIndex(value) > ------> selectItem(item:UIDToItemRenderer(uid), false, false); > ---------> var index:int = itemRendererToIndex(item) > and this returns the older position of the item, instead the new one setted > on its property index, so item has the real information but instead using it, > it uses a value returned by the function itemRendererToIndex. > -- -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira