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
2575
igxGridColumnComponent programatically set the width of a column
posted

Is it possible to set the width of certain igxGrid columns programmatically? I'm allow the grid to auto-generate the columns, but by default they're not wide enough to show the header text and sometimes the content, so I tried the following:

  onColumnInit(column: IgxColumnComponent) {
    console.log(column.field)
    if (column.field === 'Timestamp')
      column.width = '400px'
  }
This doesn't seem to affect the column width. Is this possible to do on auto-generated columns?
  • 320
    Verified Answer
    Offline posted

    Hello John VanZwieten,

    Thank you for contacting Infragistics Support.

    Yes it is possible, but there was a bug in our latest version 5.1.3, that has been already addressed and resolved in our 5.2.0 beta release. So I am sending you a zip file with sample project that use our latest release (5.2.0-beta.1) and resolves your issue. It is very important to notice a few changes that are required to do when you set up a new project with our latest version (5.2.0-beta.1):

    in file angular-cli.json you should add:

    "apps": [
        {
          "root": "src",
           ...
          "styles": [
            "styles.css",
            "../node_modules/igniteui-angular/styles/igniteui-angular.css"
          ],

    and in your styles.css  if you want to use material-icons, you should add

    If you need any further assistance, please contact us.

    Best Regards,
    Desislava Dincheva
    Associate Software Developer
    Infragistics, Inc.1732.igxGrid.zip