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

Spark Datagrid inconsistency: hovered column header index erroneously shown as -1

    XMLWordPrintableJSON

Details

    • Bug
    • Status: In Progress
    • Major
    • Resolution: Unresolved
    • Apache Flex 4.14.1
    • None
    • Spark: DataGrid
    • None

    Description

      (To clearly see the inconsistency, run the attached project or see the screenshots.)

      • The last column of a DataGrid can be sized to end before the grid ends. Let's say that the only column's width is sized to 100px, and the grid's to 600px.
      • In this situation, all the renderers will be sized to 100px, and the header renderer to 592px. All this is as expected.
      • Although the space between the last column header separator and the end of the grid (in the above example, between 101px and 592px) looks just like the last column header (which in fact it is), GridColumnHeaderGroup.getHeaderIndexAt() returns -1, falsely indicating that there's no column under the mouse pointer. This is because it uses the width of the column (100px), rather than the width of the column header (592px).
      • Moreover, the GridColumnHeaderGroup does not dispatch the GridEvent.GRID_ROLL_OVER and GridEvent.GRID_ROLL_OUT events for that part of the last header.

      This has generated a subtle fatal in our application, where we implemented a column drag and drop mechanism for our grids: we assumed that since the GridColumnHeaderGroup dispatched a DragEvent.DRAG_OVER event for that part of the last header, then GridColumnHeaderGroup.getHeaderIndexAt() could not return -1. Due to this bug, it does indeed return -1 (erroneously) for this huge swath of the column header.

      Debugging

      • GridHeaderViewLayout.getHeaderIndexAt() calls GridDimensionsView.getColumnIndexAt() - so from searching for the header index it subtly switches to searching for the column index, thus seeming to assume they should be the same (but they're not, as explained above).
      • FLEX-33328 commented out some code in GridHeaderViewLayout.getHeaderIndexAt() which dealt specifically with this scenario. To the extent it was correct, it need to be restored.

      Attachments

        1. Consistent.png
          74 kB
          Mihai Chira
        2. Demo.zip
          8 kB
          Mihai Chira
        3. Inconsistent.png
          74 kB
          Mihai Chira

        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: