E475 [Command] Table with rowspan display seems broken · Issue #21018 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Command] Table with rowspan display seems broken #21018

@aledeg

Description

@aledeg
Q A
Bug report? yes
Feature request? no
BC Break report? no
RFC? no
Symfony version 3.1.7

I was playing with tables and rowspans and it seems broken when using multiple rowspans.

I tried the following code:

$table = new Table($output);

$table->setRows([
        [new TableCell('1a', ['rowspan' => 4]), new TableCell('1a', ['rowspan' => 2]), '1', 'a'],
        ['1', 'a'],
        [new TableCell('1a', ['rowspan' => 2]), '1', 'a'],
        ['1', 'a'],
]);
$table->render();

Which renders:

+----+----+---+---+
| 1a | 1a | 1 | a |
|    |    | 1 | a |
|    |    |   |   |
|    |    |   |   |
| 1a | 1  | a |   |
|    | 1  | a |   |
+----+----+---+---+

I was expecting to have:

+----+----+---+---+
| 1a | 1a | 1 | a |
|    |    | 1 | a |
|    | 1a | 1 | a |
|    |    | 1 | a |
+----+----+---+---+

If I write my table the other way around like this:

$table = new Table($output);

$table->setRows([
    ['1', 'a', new TableCell('1a', ['rowspan' => 2]), new TableCell('1a', ['rowspan' => 4])],
    ['1', 'a'],
    ['1', 'a', new TableCell('1a', ['rowspan' => 2])],
    ['1', 'a'],
]);
$table->render();

I have the following (which was expected):

+---+---+----+----+
| 1 | a | 1a | 1a |
| 1 | a |    |    |
| 1 | a | 1a |    |
| 1 | a |    |    |
+---+---+----+----+

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0