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.

Pager is not responsive and will overflow if table width is too small -- make pager maxSize customizable

See original GitHub issue
[* ] feature request

Current behavior If the table is too small (on mobile devices, this is the case) and five pages are listed in the pager, the pager will overflow to a new line. screenshot at 18-06-10

Expected behavior The pager should adjust the maxSize if there is not enough space.

Reproduction of the problem Decrease your browser width or test on a mobile device.

What is the motivation / use case for changing the behavior? Responsive design.

  • Table version: ^1.3.1

  • Angular version: ^2.1.2

  • Browser: all

  • Language: Typescript 2

Easiest solution I can think of is allowing the maxSize to be passed in as an input, I could implement this myself and make a pull request. Have there been any other thoughts on adding responsive functionality?

Issue Analytics

  • State:open
  • Created 7 years ago
  • Reactions:5
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

6reactions
arlowhitecommented, Oct 29, 2018

Here’s the SCSS I have to override this:

// fix pager so that it doesn't wrap and uses available space
.ngx-datatable {
  .datatable-footer-inner {
    display: flex;
    flex-flow: row nowrap;  // can't wrap because footer height fixed
    justify-content: space-between;  // probably not needed because .page-count flex grows
    > .page-count {
      // remove padding so there's more room in-between
      padding-right: 0 !important;
    }
    > .datatable-pager {
      margin: 0 !important;
      // don't grow, otherwise pager won't be right-aligned
      flex: 0 0 auto !important;
      > .pager {
        // prevent numbers from wrapping
        display: flex !important;
        flex-flow: row nowrap;
      }
    }
  }
}

The other advantage of this is that the pager grows to the left instead of changing the width of the table. With this CSS, the left text will be covered by the pager when too narrow. Not sure what the best solution is. At the moment, wrapping the count and pager won’t work.

0reactions
Ilkhom-Scommented, Aug 24, 2021

Here’s the SCSS I have to override this:

// fix pager so that it doesn't wrap and uses available space
.ngx-datatable {
  .datatable-footer-inner {
    display: flex;
    flex-flow: row nowrap;  // can't wrap because footer height fixed
    justify-content: space-between;  // probably not needed because .page-count flex grows
    > .page-count {
      // remove padding so there's more room in-between
      padding-right: 0 !important;
    }
    > .datatable-pager {
      margin: 0 !important;
      // don't grow, otherwise pager won't be right-aligned
      flex: 0 0 auto !important;
      > .pager {
        // prevent numbers from wrapping
        display: flex !important;
        flex-flow: row nowrap;
      }
    }
  }
}

The other advantage of this is that the pager grows to the left instead of changing the width of the table. With this CSS, the left text will be covered by the pager when too narrow. Not sure what the best solution is. At the moment, wrapping the count and pager won’t work.

I think, total row count should be on first line, and 2 line with center should be pager. In that way pager fits mobile size and no need to scroll

Read more comments on GitHub >

github_iconTop Results From Across the Web

How can I limit table column width? - Stack Overflow
The question was answered in another StackOverflow thread. In short, you should just use width instead of max-width. – Mikhail Larionov. Dec 30,...
Read more >
max-width - CSS: Cascading Style Sheets - MDN Web Docs
The max-width CSS property sets the maximum width of an element. It prevents the used value of the width property from becoming larger...
Read more >
How to force a table into page width? - LaTeX Stack Exchange
I think this method does work when the table is small and you need to adjust it to fit the text width. However,...
Read more >
Containers · Bootstrap v5.0
Responsive containers allow you to specify a class that is 100% wide until the specified breakpoint is reached, after which we apply max-width...
Read more >
CSS max-width property - W3Schools
If the content is larger than the maximum width, it will automatically change the height of the element. If the content is smaller...
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