DashTable icon indicating copy to clipboard operation
DashTable copied to clipboard

Fixed issue with cell merges ruining offset spans.

Open r-dgreen opened this issue 4 years ago • 0 comments

Found a bug while working with data2rst and grid2data functions.

Given a table like this:

+-----+--------+-------+
| 0,0 | 0,1    | 0,2   |
+=====+========+=======+
| 1,0 | 1,1    | 1,2   |
+-----+--------+-------+
| 2,0 | 2,1        2,2 |
|     |                |
+-----+ 3,1        3,2 |
| 3,0 |                |
|     +--------+-------+
| 4,0 | 4,1    | 4,2   |
+-----+--------+-------+

When run through grid2data and back through data2rst the table gets converted to this:

+-----+--------+-------+
| 0,0 | 0,1    | 0,2   |
+=====+========+=======+
| 1,0 | 1,1    | 1,2   |
+-----+--------+-------+
| 2,0 | 2,1        2,2 |
|     |                |
+-----| 3,1        3,2 |
| 3,0 |                |
|     +--------+-------+
| 4,0 | 4,1    | 4,2   |
+-----+--------+-------+

The border between cell 2,0/3,0, and span 2,1 gets converted from + to |

When converting this new table with grid2data it creates a broken set of spans (runtests/test_rstspan.py against the original merge_cells.py to see this happen.

I've included a fix with merge_cells.py that prioritizes + when merging cells together.

r-dgreen avatar May 29 '21 02:05 r-dgreen