OnFocus Error Grouped Columns Grid

I am getting a TypeError when scrolling a grid with grouped columns. Everything seems to work, and the grid renders and scrolls correctly thought. The error only shows once you start the horizontal scroll.

The HTML:
<ejs-grid #grid id='grid'  [allowSelection]="false" [allowPaging]="true" [pageSettings]='initialPage' [enableHover]='true' 
        [groupSettings]="groupOptions" [allowGrouping]="true" [allowSorting]="true" [dataSource]="flattened" width='100%' height='100%'>..</ejs-grid...

The typescript behind:

public groupOptions: GroupSettingsModel = { showDropArea: true, columns: ['seller', 'trancheClassName'] };
initialPage = { pageSize: 10 };

This is the error:

ERROR TypeError: Cannot read property 'length' of undefined
    at FocusStrategy.push../node_modules/@syncfusion/ej2-grids/src/grid/services/focus-strategy.js.FocusStrategy.onFocus (focus-strategy.js:49)
    at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:421)
    at Object.onInvokeTask (core.js:28233)
    at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:420)
    at Zone.push../node_modules/zone.js/dist/zone.js.Zone.runTask (zone.js:188)
    at ZoneTask.push../node_modules/zone.js/dist/zone.js.ZoneTask.invokeTask [as invoke] (zone.js:503)
    at invokeTask (zone.js:1671)
    at HTMLElement.globalZoneAwareCallback (zone.js:1697)

The code causing the issue is in:

if (!this.parent.enableHeaderFocus && !this.parent.getCurrentViewRecords().length) {
            this.getContent().matrix.
                generate(this.rowModelGen.generateRows({ rows: [new Row({ isDataRow: true })] }), this.getContent().selector, false);
        }

Any suggestions?

Many thanks

1 Reply 1 reply marked as answer

MF Mohammed Farook J Syncfusion Team June 11, 2020 11:11 AM UTC

 Hi Frederik, 
 
Thanks for contacting Syncfusion support. 
 
 
We have validated the provided code example and tried to reproduce the reported issue but it was unsuccessful.  Please find the sample for your reference. 
 

Note : Horizontal scroll bar is not display when you setting width as ‘100%’ in Grid. 

Still, if you have faced same issue again , could you please share the following details to proceed further. 

  • Share the full code example about Grid rendering
  • Share the EJ2 version and Package.json details
  • Share the sample if it is possible.

Regards, 
J Mohammed Farook  


Marked as answer
Loader.
Up arrow icon