shlomiassaf / ngrid

A angular grid for the enterprise
https://shlomiassaf.github.io/ngrid
MIT License
241 stars 41 forks source link

Issue double clicking column header border to 'resize' to content width #283

Open sparqicus opened 1 year ago

sparqicus commented 1 year ago

What is the expected behavior?

When double clicking on the resize handle - I would expect that it would always resize to content.

What is the current behavior?

In certain conditions - if you resize a column down to its smallest size, and double click the column resizer to normalize the size - you'll see it pops over about 2px or so, but doesn't go to the correct width.

What are the steps to reproduce?

You can see an example here

Which versions of Angular, CDK, Material, NGrid, OS, TypeScript, browsers are affected?

My work is using latest angular 14 and related libraries. NGrid 15. But unsure what versions the example above is using.

Is there anything else we should know?

I'm running into this in a work system, and they're requiring a fix. I'm going to play around with min-widths and stuff, because not all of the example grids seem to do this.

sparqicus commented 1 year ago

Okay - so I think I found the issue.

When the column wraps or ellipses in an unexpected way (extra nesting or whatever), the code can't properly guess the width of the column.

If you're running into this, and for some reason it's a big deal, check your css to make sure you're not adding extra child containers (like a custom cell template or something), and if you are, remove text-overflow ellipses everywhere, and it'll probably work for you.

I had a custom cell specifically to add a title attribute, but removed it and switched to the tooltip feature.