Improve render performance in Angular 6 with Column Templates

Posted by: tadlockk on 26 July 2018, 4:12 am EST

    • Post Options:
    • Link

    Posted 26 July 2018, 4:12 am EST

    Hello,

    In our existing applications we use highly configured data grids all the time. While flexgrid provides great defaults for formatting and alignment, it is more often the case that we have to utilize a custom function or pipe to get the projection we are looking for. When using ng-template on grids with a lot of column the performance suffers a lot.

    Right now I setting the virtualizationthreshold to full page size and it works ok. I set the column threshold to the number of columns in the grid and the row threshold to the number of rows in a page. The latency when paging is about 2/3rds of a second with our larger grids which is something I can live with, but I would really prefer to get performance closer to what I can achieve without templates. Without templates, utilizing only format bindings, the latency is closer to a 1/3rd of a second.

    For testing, I have created a grid with three dozen columns and ng-template overrides in each cell. The content of the template just prints the value of the cell.

    
    <ng-template wjFlexGridCellTemplate [cellType]="'Cell'" let-cell="cell">
                                {{cell.item[cell.col.binding]}}
                            </ng-template>
    
    

    Using this kind of setup, what can be done to improve performance?

    Is there anyway to inject simple html into cells without the overhead of an ng-template?

    Are there any parameters I can set on a flexgrid to reduce the work it does to render each cell by, for example, giving it static properties or disabling certain features?

    Any help here would go a long way toward adoption, thank you.

  • Posted 28 July 2018, 12:09 am EST

    Hi,

    A little down in performance is expected in cases of heavy rendering but you may give cellFactory a try. It is not as convenient as celltemplates but in terms of performance, cell-factory is the best available option after default rendering.

    Please refer to the following sample to get started with cellFactory:-

    https://demos.wijmo.com/5/Angular2/CellFactory/CellFactory/

    ~Manish

Need extra support?

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

Learn More

Forum Channels