Covalent: Why is the min column width arbitrarily hard coded to 100px?

Created on 29 Sep 2017  路  8Comments  路  Source: Teradata/covalent

I am trying to build a table where I want a column to be fixed at 60px. So I looked at the API and saw that I can pass the width as a number. Didn't work.

Then I saw I could pass an object {min: NUMBER, max: NUMBER} for the column configuration and I hoped that would do it for me. No! It was always at least 100px.

I went here - https://github.com/Teradata/covalent/blob/develop/src/platform/core/data-table/data-table.component.ts#L972-L975 and I realized that any column declaring width less than 100 px is being set to 100px. Which is weird.

Right now, I can't possibly set the width of any column narrower than 100px :(

bug

Most helpful comment

I noticed the same issue when I put in smaller values than 100px.
When investigating, I found another issue, but I don't know if it is related, so I will comment it here:
The width: {min: 300, max: 500} object when defining my columns, the max-width is applied as the min-width on the element.

Here is the element style from Google Chrome.
screen shot 2017-09-29 at 12 45 57 pm

I will try and continue on how to fix this if. It seems that the issue first came from this PR. https://github.com/Teradata/covalent/pull/859. Before this, columns would expand by width and height naturally depending on the content in the grid.

All 8 comments

100 is the default, try setting width to something smaller than 100. To be clear, set width specially not min or max

I tried that but even then I get a minimum of 100px.

Can you post a stackblitz or plunker?

I noticed the same issue when I put in smaller values than 100px.
When investigating, I found another issue, but I don't know if it is related, so I will comment it here:
The width: {min: 300, max: 500} object when defining my columns, the max-width is applied as the min-width on the element.

Here is the element style from Google Chrome.
screen shot 2017-09-29 at 12 45 57 pm

I will try and continue on how to fix this if. It seems that the issue first came from this PR. https://github.com/Teradata/covalent/pull/859. Before this, columns would expand by width and height naturally depending on the content in the grid.

@dubemarcantoine is there a plunker template?

I did not do one yet, I'll do it later today/tomorrow after school!

I am sorry. I wanted to tag @kyleledbetter :) Is there a plunker template i can use?

The min/max is indented to work that way, because table cells are really stubborn when trying to set the widths.. we calculate the needed width and set it to both min/max to ensure it works properly.

The 100px one was so we could have a min width, but i do agree 100px seems really random and you should be able to override it. A fix for this will be addressed https://github.com/Teradata/covalent/pull/895

Btw, the plnkr URL is in the issue template.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

georgeedwards picture georgeedwards  路  4Comments

d3viant0ne picture d3viant0ne  路  3Comments

trkbrkr2000 picture trkbrkr2000  路  5Comments

victorboissiere picture victorboissiere  路  5Comments

chdanielmueller picture chdanielmueller  路  3Comments