Skip to content

Sorting breaks resizing #10

@sofoklisM

Description

@sofoklisM

Sorting in data grid breaks resizing.

For one thing the the offset and width of the header are incorrect once the header is sorted.
But what's worse is that DataGrid does not propagate the events to the Header because
headerBuilder.isHeader returns false for a column that's sorted.
That seems to me like DataGrid bug.

That's from AbstractCellTable.onBrowserEvent2

    /*
     * Look for the most immediate header parent if not already found. Its
     * possible that the footer or header will mistakenly identify a header
     * from the other section, so we remember both. When we eventually reach
     * the target table section element, we'll know for sure if its a header
     * of footer.
     */
    if (headerParent == null && headerBuilder.isHeader(cur)) {
      headerParent = cur;
    }

   ....
  boolean shouldSortColumn = true;
  // Fire the event to the header.
  if (headerParent != null) {
    Header<?> header =
        isHeader ? headerBuilder.getHeader(headerParent) : footerBuilder
            .getHeader(footerParent);

    if (header != null) {
      int headerIndex = isHeader ? headerBuilder.getRowIndex(targetTableRow) :
          footerBuilder.getRowIndex(targetTableRow);
      Context context = new Context(headerIndex, col, header.getKey());

      if (cellConsumesEventType(header.getCell(), eventType)) {          
        header.onBrowserEvent(context, headerParent, event);
      }

      if (isSelect) {
        // Preview the event, and possibily disable the column sort event. The event preview is
        // forced even if the header cell does not consume click event
        shouldSortColumn = header.onPreviewColumnSortEvent(context, headerParent, event);
      }
    }
  }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions