IE performance / Templates and components with cell factories

Posted by: philip.johnson on 23 January 2018, 6:53 am EST

    • Post Options:
    • Link

    Posted 23 January 2018, 6:53 am EST

    We’re having issues with grid performance in IE 11. Some issues are annoying but we can live with and blame on IE, e.g. white flashes when scrolling quickly and frozen columns lagging a few pixels off the regular columns when scrolling. These can both be seen in IE at http://demos.wijmo.com/5/Angular2/Explorer/Explorer/#/grid/frozen .

    However, we’re also having an issue where cells are not aligning properly after a quick scroll. In other words, a row might actually be showing data from other rows. I have included a gif that shows this. Notice how the data changes after the first column. It’s a big problem, as we can no longer trust our data.

    We suspected this was because we were using a template in order to customize the display of our number data (although the grid should still settle correctly at the end of a scroll) and this was slowing performance. So we tried using cell factories instead of templates or itemFormatter in order to speed things up. This in fact did eliminate the problem. However, now we can no longer include any Angular code into our cells, as angular components don’t seem to compile. Nor can we use cell templates, which seem to be ignored if there is a cell factory. For example, this doesn’t work:

    
    if (cell.textContent != content) {
        cell.innerHTML = '<mat-icon>' + content + '</mat-icon>';
    }
    
    

    So our question is that is there some way to use templates and Angular components with cellFactories? Or, even better, is there some reason our grid is so slow in IE that there’s a bug? Even when we’re not using templates or itemFormatter and have only 40 rows of data and twelve columns, it seems laggy. However, this page: http://demos.wijmo.com/5/Angular2/Explorer/Explorer/#/grid/dynacols seems good enough, even with more rows and a template. So where is this slowness coming from? The number of cells visible (with a full screen our grid shows approximately 21 rows x 12 cols = 252 total cells)?

    
    <wj-flex-grid #grid class="data-grid" fxFlex="grow"
                  (dblclick)="onGridDblclicked($event)"
                  [itemsSource]="dataCollection"
                  [frozenColumns]="frozenColumns"
                  [headersVisibility]="'Column'"
                  [autoGenerateColumns]="false"
                  [isReadOnly]="true"
                  [selectionMode]="'Row'"
                  [allowResizing]="'None'"
                  [allowDragging]="'None'"
                  [allowSorting]="true"
                  [showAlternatingRows]="true"
                  [stickyHeaders]="true">
    </wj-flex-grid>
    
    

    the code for column creation when our component first loads:

    
    this.columns.forEach(col => {
          this.grid.columns.push(new Column({
            binding: `${col.key}`,
            header: `${col.name}`,
          }));
        });
    
    

    and here’s the format of a column type:

    
    {
                key: 'ExColumnBinding',
                name: 'ExColumnHeadingTitle',
                dataType: FieldDataType.Number,
                format: '(0.0 %)',
    },
    
    

    Thanks.

  • Posted 23 January 2018, 7:46 am EST

    Also, FYI, it seems to be only that final frozen column where the alignment bug is happening in IE.

  • Posted 23 January 2018, 6:03 pm EST

    Hi Philip,

    We are sorry indeed but we are unable to replicate the issue at our end with the build 5.20173.405.

    Please test with the attached sample.

    If possible, please modify the attached sample depicting your issue in case if the issue persists.

    ~Manish

    FlexGrid_scroll_IE_differentText for FrozenColumns.zip

  • Posted 24 January 2018, 11:14 am EST

    I was able to replicate. The issue seems to be with using a large number of templates. Actually this version (which I altered fairly quickly) really, really drags in IE 11, though it’s fine in Chrome. And the number change bug is there, at least on my computer. Perhaps there’s a better method that you can recommend to deal with altering lots of cells?

    And this begs the question, if we use the cellFactory to format our numbers (we need to do something, as we have custom formats for each column beyond the built-in wijmo formats), can we use a template in only one of the columns somehow?

    I might also suggest it would be helpful to have a property attached to WjFlexGridColumn that is a callback for an itemFormatter for only that column, so we can do it on a per-column basis rather than having a single function that must account for every cell in the table.

    FlexGrid_scroll_IE_differentText.zip

  • Posted 24 January 2018, 6:05 pm EST

    Hi Philip,

    Thank you for the modified sample.

    This issue goes away as we set cloneFrozenCells property to false. Please use the following code snippet :

    <wj-flex-grid #grid
                  [itemsSource]="data"
                  [frozenColumns]=frozenColumns
                  [headersVisibility]="'Column'"
                  [autoGenerateColumns]="false"
                  [isReadOnly]="true"
                  [selectionMode]="'Row'"
                  [allowResizing]="'None'"
                  [allowDragging]="'None'"
                  [allowSorting]="true"
                  [showAlternatingRows]="true"
                  [stickyHeaders]="true"
    [b]              [cloneFrozenCells]="false"[/b]
                  style="height: 590px;">
    
      <wj-flex-grid-column *ngFor="let col of columns"
                           [header]="col.header"
                           [binding]="col.binding"
                           [format]="col.format">
        <ng-template *ngIf="col.dataType == 2" wjFlexGridCellTemplate [cellType]="'Cell'" let-cell="cell" let-item="item">
          {{ item[col.binding] }}
        </ng-template>
      </wj-flex-grid-column>
    </wj-flex-grid>
    

    ~Manish

  • Posted 25 January 2018, 4:54 am EST

    Excellent. This did take care of the alignment problem. Thank you!

    We did like the fast performance of using cellFactories, however. Can we use this and still access cellTemplates for a few columns?

  • Posted 29 January 2018, 9:00 pm EST

    Hi Philip,

    With IE rendering, the performance may be hit with Cell templates. You may use formatItem and itemFormatter for apply customization.

    However, you may use cell template with cloneFrozenCells property.

    ~Manish

Need extra support?

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

Learn More

Forum Channels