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.

All columns collapse when resizing the browser window.

See original GitHub issue

I’m submitting a …

  • bug report

Current behavior

  • Chrome (on 2.0.0 or 2.1.1): When the window is resized, the column layout collapses.
  • FF/Safari (on 2.0.0): When the window is resized, the column layout collapses.
  • FF/Safari (on 2.1.1): Columns are collapsed on page load.

Expected behavior

The table should retain it’s columns as it is resized (always filling the width of it’s parent).

Reproduction of the problem

I couldn’t get the suggested Plunker link working so I’m posting a gif… demodatatableresizebug

What is the motivation / use case for changing the behavior?

A user should be able to resize the browser window as the table expands/contracts while retaining columns.

Please tell us about your environment:

  • NPM / OSX / Karma / angular-cli

*Table version:

  • Bug present on 2.0.0 or 2.1.1 (didn’t test 2.1.0)
  • Not present on previous 1.x.x versions

*Angular version: 2.2.4

*Browser:

  • Chrome
  • In Firefox and Safari it seems that the layout bug presents on load; before resizing.

*Language: TypeScript 2.1.1

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:11 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
benjamincharitycommented, Dec 9, 2016

Update

In case anyone else comes across this looking for a solution:

  • a) On load, the datatable layout is broken
  • b) Switching tabs, fixes the layout
  • c) Resizing the window breaks the layout again
  • d) After a resize, switching tabs no longer fixes the layout

Example:

2016-12-09 12 01 52

Current workaround

  • Set the initially selected tab to one that isn’t the first one (so if the first tab should be shown first, initially set the second tab as the default tab.
  • Then in your ngOnInit method set a timeout for 100ms and dynamically set the 1st tab as the selected tab.
export class YourComponent implements OnInit {
    // I really want the tab index of `0` to be shown initially, but we default to the 2nd tab
    public currentTabIndex = 1;

    ngOnInit() {
            setTimeout(() => {
                // This will move to the first tab which will have a correct layout now
                this.currentTabIndex = 0;
            }, 100);
    }
}
<md-tab-group
  md-stretch-tabs
  flex
  [selectedIndex]="currentTabIndex"  <!-- this is what we are changing in ngOnInit -->
  (selectChange)="tabSelected($event)"
>
</md-tab-group>

Note: Dynamically setting the active tab doesn’t work until @angular/material: 2.0.0-alpha.11-2

0reactions
arturtupiassucommented, Jun 12, 2018

Any lucky, guys? I’m stuck with the same problem …

Read more comments on GitHub >

github_iconTop Results From Across the Web

Bootstrap columns are overlapping when the browser window ...
I'm new to Bootstrap and having some styling issues with a project I'm working on. When my window is resized and made smaller,...
Read more >
Columns are not resized when changing browser window ...
I've found a problem with table resizing and hidden columns in 1.9.0. If you view the test case in a browser window at...
Read more >
Prevent Columns From Collapsing In GridView - MSDN
It does not maintain the column width if the browser is resized. I'm looking for the results similar to what occurs when placing...
Read more >
Resizing and collapsing panes and browsers - One Commander
Each Browser has a minimum width (Standard Layout) or height (Columns Layout). When that minimum is reached a "collapse" message appears, and if...
Read more >
Hide Grid Columns When the Browser Width Is Too Small
If the Grid doesn't have any hidden columns when the browser window is resized, collapse all detail rows. Use CSS to conditionally display...
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