question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

minCellWidth is not respected when using colspan other than 1

See original GitHub issue

Here’s my example, I need an explanation of this behavior and possible solution. image

The layout consists of 6 logical columns (but because there is not enough data the last visual column took all remaining ones using colspan, for example Multi File Upload has colspan of 3 and A or B Single took a colspan of 2)

The whole table has width of 190, every visual column has minCellWidth of 22.62, except for Multi Image which was set to 67.5.

Multi Image

          const paramCell: CellDef = {
            colSpan: 2,
            styles: { minCellWidth: 67.5, cellPadding: 1.76},
          };

The issue is, it didn’t get it’s 67.5 but gets 62.1284178912133 for some unintuitive reason. Even when I try to set it manually in didParseCell or willDrawCell it still is being rendered with less width and image gets cut.

   const cellWidth = data.cell.width;
   const minCellWidth = (data.cell.raw as CellDef).styles.minCellWidth;
   data.cell.width = cellWidth < minCellWidth ? minCellWidth : cellWidth;

I don’t understand why doesn’t it get it’s desired width!? 190 - 22.62 * 5= 76.9, which is higher than 67.5, meaning that there’s still some space left after giving every visual column it’s desired minCellWidth And why setting width manually also doesn’t work…

My suspicions are that next rows somehow override values, making previous rows to recalculate stuff wrong.

P.S. If I set colspan of Multi Images to 1, the minCellWidth is respected (but the whole layout gets logically broken)

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:1
  • Comments:10 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
stale[bot]commented, Jul 4, 2020

This issue has been automatically closed since the issues in this project are mainly used for bugs and feature requests. Questions are directed to stackoverflow.

0reactions
Nervniyakcommented, Aug 21, 2020

@simonbengtsson review PR please.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why is colspan not applied as expected - Stack Overflow
I have a table according to below. The second row has defined three columns, one with colspan=8 ...
Read more >
Table Rowspan And Colspan In HTML Explained (With ...
Allows a single table cell to span the height of more than one cell or row. Why use colspan= or rowspan= ? Sometimes...
Read more >
[Solved] Colspan problem - CSS-Tricks
I wanted this table to have 2 rows with 3 columns, of which the the first one is about the double width of...
Read more >
Explain what is a colspan attribute? - Codecademy
HI When i use a colspan attribute ,no matter what number i assign to it i ... 1 vote. Permalink. colspan specifies the...
Read more >
Trouble with colspan in Outlook 07/10/13 - Litmus
Not really an answer but try to avoid col and row span. Its as dangerous for the rendering as for code modification. Use...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found