Set width of column dynamically

Posted by: parmarkinjalk on 4 May 2020, 9:09 pm EST

  • Posted 4 May 2020, 9:09 pm EST

    Hi Team,

    How do I set the width of a column dynamically? I am using latest wijmo with angular -8. I have a grid with 7 or 8 columns and I have a div beside this grid. I have set the width of different columns by using the width property (E.g. [width]=“140”) so the grid has a horizontal scroll due to lack of space. Now when I am hiding the side div the grid expands to take the width of entire screen, now I want to change the width to use the ‘'star method(E.g. [width] = "'1’") for all the columns. How do I change the width to use the * value so the grid fits the entire screen in all resolutions. Thanks.

    Regards

    Kinjalk Parmar

  • Posted 5 May 2020, 2:48 am EST

    Hi Kinjalk,

    Whenever, you hide the side div, you may iterate over each column and set its width to ‘*’:

    grid.columns.forEach(c => c.width = '*');
    

    But, if you are star-sizing the columns, then you do not need to initially set their width to a constant value. Whenever the side div will be displayed/hidden, the star-sizing will automatically adjust the columns width accordingly.

    Regards,

    Ashwin

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels