Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Columns Squish together under certain conditions #1165

Open
matthewbrozen opened this issue Nov 30, 2017 · 32 comments · May be fixed by #1561
Open

Columns Squish together under certain conditions #1165

matthewbrozen opened this issue Nov 30, 2017 · 32 comments · May be fixed by #1561

Comments

@matthewbrozen
Copy link

I'm submitting a ... (check one with "x")

[x ] bug report => search github for a similar issue or PR before submitting
[ ] feature request
[ ] support request => Please do not submit support request here, post on Stackoverflow or Gitter

Current behavior
I have a angular 4 application that uses angular material mat tabs to display multiple ngx-datatables. Sometimes when I go from tab to tab under certain conditions the tables columns get squished together but when I open the google developer tools to inspect it the table fixes itself

Expected behavior
The expected behavior is that the columns display in their proper format and don't get squished together

Reproduction of the problem
squished

This is a large project and I am not able to recreate the issue in plunker but I have attached the image of the bug. This occurs with angular material 2.0.0-beta.12 mat-tabs.

What is the motivation / use case for changing the behavior?
To properly display the data

Please tell us about your environment:

OS X El Capitan version 10.11.6

Atom IDE

NPM 4.3.0

angular/cli 1.4.9

swimlane/ngx-datatable 9.3.1

Chrome

  • Table version: 0.8.x

swimlane/ngx-datatable 9.3.1

  • Angular version: 2.0.x

angular/core 4.2.4

  • Browser:

Chrome

  • Language:

Typescript

@mcblum
Copy link

mcblum commented Nov 30, 2017

I've seen this same thing when the screen changes sizes and there's a table that's still in the dom but out of view because of tabs or something. What happens if you remove the table and then put it back when the view switches back?

@arlowhite
Copy link
Contributor

I have a similar issue after upgrading from 11.0.4 to 11.1.5
However, for me the header columns are squished but the body is normal. This may be because I set the columns first, and then later set the data.
The header columns layout correctly once I scroll the table.

@arlowhite
Copy link
Contributor

Inspect the <div> around <datatable-header-cell> with class="datatable-row-center"
During the bug, it has width: 0px; After scrolling, the width gets a value.

@arlowhite
Copy link
Contributor

Another similar issue is that when I pin a column, it is "squished" until I scroll (vertically or horizontally).

@padilla-jm
Copy link

I had the same issue after upgrading to 11.1.5

@olaf89
Copy link

olaf89 commented Dec 21, 2017

Same here, had to pin 11.0.4.

@mcblum
Copy link

mcblum commented Dec 21, 2017

Does this have anything to do with #1161? We've been struggling with that.

@Logic-Bits
Copy link

Just wanna push this, happens here too.
BTW, using it inside of a Material Tab.

@kuhlschrank
Copy link

kuhlschrank commented Jan 8, 2018

Same here. Issue occurs since updating from 11.0.4 to 11.1.7.
I'm not using the datatable inside a material tab.
Column mode is set to fixed and width values are applied correctly to the style attribute.

Headers and columns are squished as shown in the original post's screenshot.

EDIT: "Sometimes" only the headers get squished. Data columns are fine.
Also: When I start scrolling - everything squished is immediately resized correctly.

@darkurse
Copy link

darkurse commented Jan 17, 2018

Same here, only a windows resize corrects it (i'm in force column mode). In my case only headers are squished, data is ok.

However, I think I got to the bottom of this and made a PR which hopefully fixes the header issue.

For a quick fix and see if it works for you, go to file @swimlane/ngx-datatable/src/components/header/header.component.ts line 103. Basically at the end of the @Input() set columns() property and add the line this.setStylesByGroup(); at the end.
Let me know if this works for you ?!

@jkon
Copy link

jkon commented Jan 23, 2018

I am having this issue too. I change the set of columns in my tables a lot, so having the recalculation of the column widths (including in the headers) work correctly is important to me.

@kumaranish8888
Copy link

Well I found a temporary solution to this one. I receive the table data in the setTimeout giving it a minimal time of 100 ms. Now it stays squished for like 100ms and gets back to normal, you won't even realize that it was squished at any moment. I know this is not a perfect solution but glad I have something that is working fine and I didn't had to deal with version change.

@witheroux
Copy link

witheroux commented Apr 25, 2018

This would happen to me on activate on a row or initial loading of a table. This only happened when I had two tables with the same columns object and one of the two tables was hidden making the browser report a width of zero on the column I suppose. I didn't dive into the code to see where this happened or why but hopefully this can help someone.

Made a stackblitz to illustrate the issue. Resize to have the first table "re-appear" and then do something to toggle a row's activate event and the tables will squish back to zero.

@PLopezD
Copy link

PLopezD commented May 30, 2018

+1 -- for me it's when users go from smaller window to max size. Resize just doesn't fire

@gpessa
Copy link

gpessa commented Jun 11, 2018

Same issue here

@arturtupiassu
Copy link

+1

@la-jamesh
Copy link

Can confirm this is still a very real thing. If you have two tables tabs of that hide the table they contain. if you resize and jump back and forth there is some crazy behaviour going on. I'd be happy to put in a PR if an experienced dev could point me towards the table resizing logic.

@V-Mario
Copy link

V-Mario commented Jul 18, 2018

+1

@koderi-dp
Copy link

Same issue...

@brandonyoung
Copy link

+1

@hensleyrob
Copy link

+1

Any update on this? May have to switch to a different data table if this doesn't get figured out as it's killing or UI currently.

@duck74
Copy link

duck74 commented Aug 30, 2018

+1
I might have the same issue. I am reusing a datatable component in a modal and when I have resized the browser window before (does not matter, if there was another datatable on it or not) then the contents of the table, when I open it, gets squished to the left. When I resize the window again, it jumps back to looking fine.

@koderi-dp
Copy link

when we can expect this pull request #1561 in master?

@donnalmh
Copy link

Hi, Just to bump up on this, am still experiencing it. is there a fix for this? Thanks

@koderi-dp
Copy link

I think you should switch to primeng...

@jarodsmk
Copy link

I just experienced this with a custom component rendering my <ngx-datatable> through content projection (by using <ng-content>)

If the datatable has it's inputs populated, but the parent component only renders it's body afterwards, this could occur.

Fixed by firing a window resize event, and writing the relevant unit test, but since this project isn't maintained much any more - if anyone has severe issues with this, might be worth investigating using a more supported datatable library, primeng or ag-grid to name some.

Unless...
@marjan-georgiev - is there any chance of someone being assigned to this project to attend to/review the open PRs that may resolve the issues open & allow more open source contribution & interaction?

@azeay
Copy link

azeay commented Feb 28, 2021

On Init just invoke the resize event
//javascript
window.dispatchEvent(new Event('resize'))
This works fine with me

@pgqueme
Copy link

pgqueme commented Sep 21, 2022

Trying everything I could think of, adding this CSS to my global styles seems to work so far:

datatable-body-cell.datatable-body-cell {
    width: -webkit-fill-available !important;
}

@Arti3DPlayer
Copy link

+1

@jcandiap
Copy link

Did anyone manage to solve this? 😂

@Arti3DPlayer
Copy link

@jcandiap I migrated to Angular material tables too

@grantwforsythe
Copy link

I solved this by setting the column mode to flex, setting [flexGrowth]="1" for each column, and fixing the position of .datatable-header-inner

.datatable-header-inner {
  position: fixed;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.