Skip to content

Incorrect column index calculation when cells are joined #134

@brunoagretti

Description

@brunoagretti

Describe the bug

When applying styles to header/footer cells, the column index is not calculated correctly if cells are joined.
This happens in HeaderFooterStylesHelper, method:

private int getColumnIndex(int rowIndex) {
  ROW row = getRowSelector().getRow();
  int j = -1;
  for (Column<?> c : helper.getGrid().getColumns()) {
    if (c.isVisible()) {
      ++j;
      if (getCell(row, c) == getCell()) {
        break;
      }
    }
  }
  return j;
}

The variable j keeps incrementing regardless of whether the cell has been joined, which results in wrong indexes being used and styles not being applied.

Expected behavior

The index calculation should consider joined cells so that styles are applied to the correct column.

Minimal reproducible example

No response

Add-on Version

1.4.0-SNAPSHOT

Vaadin Version

23.3.32

Additional information

No response

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions