Uploaded image for project: 'Apache Flex'
  1. Apache Flex
  2. FLEX-34838

getItemIndex returns -1 for item whose property was edited with GridItemEditor in a sorted DataGrid

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • Apache Flex 4.14.0
    • Apache Flex 4.15.0
    • Spark: DataGrid
    • None

    Description

      In GridItemEditor.save() the sort is removed from the dataProvider, the change is made, and after that the sort is reapplied, but without calling refresh() on the collection. This effectively means that we're fooling the dataProvider into thinking that its items are correctly sorted according to the sort properties (by this I mean that if we call getItemIndex, it will use its sort info to find it, thinking everything is in order), when in fact the order is now practically random. Yes, this can be a problem when trying to remove the selected item (see FLEX-34837), but it's much wider than that: usually a dataProvider is accessed by the developers long after it's assigned to a DataGrid, and they expect (especially if it wasn't sorted to begin with) that getItemIndex() will work correctly for their custom code. But due to this bug it will often return -1.

      Steps to reproduce:

      • Run the attachment to FLEX-34837 and repeat the steps for the "Name" column instead of the "Street" one.

      Attachments

        Issue Links

          Activity

            People

              evolverine Mihai Chira
              evolverine Mihai Chira
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: