Frozen Columns throw error when being set after view init

Hello Syncfusion Team, 

I am having difficulties with Frozen Columns in Angular Grid. 

I developed a dynamic grid of which the grid data and column data are loaded asynchronously and therefore are set after the ngAfterViewInit hook. That was working until now, but when I tried to use frozen columns, I am running into the error:

ERROR Error: Uncaught (in promise): TypeError: Cannot read properties of undefined (reading 'querySelector')

To simulate this problem I created a stackblitz sample with two grids. Both grids can be provided with column and grid data via a button press (making sure it is after view init). 

You notice that the grid that has no frozen column will adapt itself perfectly fine. 

But the grid with the frozen column throws the error. Only difference is the one freeze attribute. 

https://stackblitz.com/edit/angular-joxzbn-nqvzzm?file=app.component.ts

Is that a know issue? Can this be avoided?


Thanks in regard 
Jonas!



1 Reply

JC Joseph Christ Nithin Issack Syncfusion Team September 7, 2022 05:40 PM UTC

Hi Jonas,


  Greetings from Syncfusion support.


Based on your query, you are facing some issue when you are defining the freeze direction for the  grid dynamically. Your requirement can be solved by calling the `grid.freezeRefresh`  method after defining the freeze for the columns. We have also modified the sample provided and it is working fine now.


Sample: https://stackblitz.com/edit/angular-joxzbn-tweqqx?file=app.component.html,app.component.ts


Please get back to us for further details.


Regards,

Joseph I.


Loader.
Up arrow icon