Skip to content

Infragistics Community Forum / Web / Ignite UI for Angular / how to dynamically generate IgxGrid columns

how to dynamically generate IgxGrid columns

New Discussion
Alok shahi
Alok shahi asked on Jul 3, 2020 11:30 AM

hello,

i m trying to import igxGridColumncomponent but i think there is no such component present in ignite ui library. basically i want to generate grids column automatically how can i do that programatically without using templates.

Sign In to post a reply

Replies

  • 0
    Zdravko Kolev
    Zdravko Kolev answered on Aug 10, 2018 12:49 PM

    Hello Alok Shashi,

    There is such component (column.component.ts file)

    Possible use:

    import {
        IgxGridComponent, IgxButtonGroupComponent, IgxColumnComponent
    } from 'igniteui-angular';

    initColumns(event: IgxColumnComponent) {
     const column: IgxColumnComponent = event;
     if (column.field === 'Name') {
      column.filterable = true;
     }
    }

    It is not possible to generate columns automatically and assign them to the grid. The correct and recommended ways is by using templates or by using the autoGenerate property. 

    Approach that you could follow, add <igx-column> in the template and use "*ngFor="let col of columns" in order to add as many columns as you want in the Grid.

    • 0
      Alok shahi
      Alok shahi answered on Aug 10, 2018 12:56 PM

      i have tired *ngFor to generate it dynamically but that dosen't work.please can u provied me more detail

      • 0
        Zdravko Kolev
        Zdravko Kolev answered on Aug 14, 2018 11:01 AM

        This is a sample that is showing how to generate columns with ngFor and column collection.

      • 0
        Krishna Joshi
        Krishna Joshi answered on Apr 24, 2020 1:12 PM

        I know, this has been a old post, but is there a sample available which includes column groups also  (with multilevel column groups) ?

      • 0
        Deepak Bandapati
        Deepak Bandapati answered on Jul 3, 2020 11:30 AM

        hi, if i generate columns dynamically, clipboardoptions are not working,request you to provide a way to achieve copy multiple rows/columns functionality

  • You must be logged in to reply to this topic.
Discussion created by
Favorites
Replies
Created On
Last Post
Discussion created by
Alok shahi
Favorites
0
Replies
5
Created On
Jul 03, 2020
Last Post
5 years, 8 months ago

Suggested Discussions

Created by

Created on

Jul 3, 2020 11:30 AM

Last activity on

Feb 16, 2026 1:19 PM