igniteui-angular icon indicating copy to clipboard operation
igniteui-angular copied to clipboard

IgxGrid layout issue with global font settings

Open ymita opened this issue 7 years ago • 7 comments

Question

I want to set font-size globally – e.g. 11px. Then the header layout of IgxGrid becomes broken. As you can see from the screenshot, the header cell height is not enough and there is a space underneath. How can I set font-size globally and use IgxGrid without issue?

image

You can see it on this sample. https://stackblitz.com/edit/angular-timgrc?file=src/styles.scss

  • igniteui-angular version: 7.2.4
  • browser: n/a

ymita avatar Apr 11 '19 04:04 ymita

@ymita In general, the igx-typography should be used to change the fonts for the components.

https://www.infragistics.com/products/ignite-ui-angular/angular/components/themes/typography.html

kdinev avatar Apr 11 '19 08:04 kdinev

@ymita This is not an issue with the theming. The issue lies with how we calculate the height for multicolumn headers. Since the height is calculated using javascript, it doesn't care about font size, thus not resizing when everything else changes scale. The themes use relative units, so changing the global font size should generally scale every component in your app.

simeonoff avatar Apr 12 '19 07:04 simeonoff

@zdrawku Hi How much effort will this be ?

SlavUI avatar Apr 25 '19 08:04 SlavUI

Hi @simeonoff , here is a workaround I figured out.

Can you apply fix based on this workaround?

:host::ng-deep {
    // Workaround for #4519

    // change display from block to flex 
    .igx-grid__thead-item {
        display: flex;
        flex-flow: column nowrap;
    }

    .igx-grid__thead-item {
        // void auto sizing
        > .igx-grid__thead-title {
          flex: 0 0 auto;
        }

        > .igx-grid__thead-group {
            flex: 1 1 auto;
        }
    }

    .igx-grid__thead-item {
        // auto sizing header height
        > .igx-grid__th {
            flex: 1 1 auto;
        }
    }

    // In addition,
    // if you want to shrink header height according to font size,
    // you need to apply the following styles.
    .igx-grid__thead-wrapper {
        height: 10rem !important;
    }
    .igx-grid__th {
        height: auto !important;
    }
}

tkiryu avatar Jun 24 '19 09:06 tkiryu

@kdinev @mpavlinov @simeonoff Can you add the bug fix to 7.3.x as well?

ymita avatar Jul 02 '19 08:07 ymita

@ymita Done

rkaraivanov avatar Jul 02 '19 08:07 rkaraivanov

@rkaraivanov Thanks!

ymita avatar Jul 02 '19 08:07 ymita