Setting auto height to flexgrid rows angular2

Posted by: prem on 14 September 2017, 12:08 pm EST

    • Post Options:
    • Link

    Posted 14 September 2017, 12:08 pm EST

    We have requirement to adjust height of wijmo rows automatically based on content inside the cell. But all the row heights are getting adjusted to align with the row with maximum content(height).

    Following is the code to set the same.

    this.flex.autoSizeRows(0, this.flex.cells.rows.length, false);

    We have this code called inside ngAfterViewInit(). But this is not working.

    Which is the right event of grid to use for this purpose?

    Thanks in advance

  • Posted 14 September 2017, 12:08 pm EST

    Hi Prem,

    Are you using wjFlexGridCellTemplate in your project for customizing cell? If yes, set [autoSizeRows] to false in template tag as per following code snippet.

    <template wjFlexGridCellTemplate [autoSizeRows]="false">
    </template>

    This will prevent resizing row automatically to fit the maximum content.

    Thanks,

    Manish Kumar Gupta

  • Posted 14 September 2017, 12:08 pm EST

    Thank you. It worked as expected.

  • Posted 14 September 2017, 12:08 pm EST

    It seemed to be working but actually not. When I apply this, it is not adjusting to column content. I didn’t realize the issue when there is only 2 line content. In case of multiple lines content, it is getting truncated. It displays only top 2 lines. Height is not getting adjusted to content and the remaining lines getting truncated.

    Thanks.

  • Posted 14 September 2017, 12:08 pm EST

    Hi Prem,

    Along with setting [autoSizeRows] to false, you need to call autoSizeRows() method for resizing rows in the updatedView event. For your reference, please see the plunker that implements the same.

    http://plnkr.co/edit/4hquR7EFKufjxQ1skyJE?p=preview

    Thanks,

    Manish Kumar Gupta

  • Posted 22 June 2018, 7:40 am EST

    We recently upgraded to wijmo 5 and the solution is not working now. Please let us know the solution for wijmo 5. Thanks in advance.

Need extra support?

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

Learn More

Forum Channels