Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
15
Igx tree grid & grid column header modifications
posted

Hi team,

Our project has requirements due to which there is a need to modify column headers in IGX tree grid and flat grid. Which are:-

1. Height decrease: We need the height of the header of columns decreased, currently its taking a lot of space. We need a solution which is universal as we have multiple grids in our application and some has tree grid with and without  column groups/parent child columns and different column schemas.



2. Conditional Styling: We need to style the column headers (background colour, font colour) conditionally, currently there is a way to change theses styles by applying our own theme but its globally applied on all column headers and we need to add conditions based on which some styles will be applied and some not on the headers.


Please let us know with the solutions for these queries.

Thank you.

Parents Reply
  • 1560
    Offline posted in reply to Saurabh Suman

    Hello,


    After an investigation, I have determined that as it is mentioned in the release notes
    here, headerStyles property was introduced in version 12.2.0.


    In addition, please keep in mind that according to our policy we provide support for the latest version and two major versions back of the igniteui-angular product. This means that version 10 is considered retired and it is no longer eligible for Developer Support Services.


    Having this in mind, my suggestion is to update to the latest version.


    However, having in mind that the headerStyles property is setting a style to the igx-grid-header element, a possible approach which could be used in earlier versions is to access these elements and modify their properties based on some condition:


     public ngAfterViewInit(): void {
      const headers = document.querySelectorAll('igx-grid-header');
      headers.forEach(header => {
        if((header as any).innerText === 'Name' || (header as any).innerText === 'Age') {
          header.setAttribute('style', 'background: red');
        }
      });
    }

    Let me know if I may be of any further assistance.

    Sincerely,
    Teodosia Hristodorova
    Software Developer

Children