We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Grid virtualization is not working properly

Dear all,

I'm using ejs grid for represent my data and it will load large data set bigger than 1000 records. In that case I decided to enable virtualization in the gird as well as to improve performance. Code as below,

<ejs-grid #dataGrid [dataSource]='data' [columns]='columns'
[filterSettings]='filterSettings' [contextMenuItems]='contextMenuItems'
[editSettings]='editSettings' height='100%' [toolbar]='toolbar'
(toolbarClick)="toolbarClicked($event)" (cellEdit)="cellEdit($event)"
(beforeBatchAdd)="beforeBatchAdd($event)" (beforeBatchSave)="beforeBatchSave($event)"
(queryCellInfo)='cellTooltip($event)'
(excelHeaderQueryCellInfo)='excelHeaderExporting($event)'
(excelQueryCellInfo)='excelCellExporting($event)' (dataBound)="dataBound()" [enableVirtualization]='true'>
</ejs-grid>


My problem is, when enabling Virtualization setting it will load empty spaces on both top and bottom in the grid while moving up and down. Please advice me to solve this problem and have I been done wrong way to achieve this Virtualization?

12 Replies

MS Madhu Sudhanan P Syncfusion Team March 27, 2019 06:53 AM UTC

Hi Shamil, 

Thanks for contacting Syncfusion support. 

From your code we found that you have provided the height to Grid in percentage. This percentage value is caused this issue. So please provide the static number to Grid height instead of using the percentage(like as following code snippet), 

 
<ejs-grid #grid [dataSource]='data' [enableVirtualization]='true' height=500> 
     
</ejs-grid> 

We have attached the demo virtualization sample with this update for your reference and you can find that demo in the below link, 


Regards, 
Madhu Sudhanan P 



NE Neo replied to Madhu Sudhanan P March 27, 2019 10:13 AM UTC

Hi Shamil, 

Thanks for contacting Syncfusion support. 

From your code we found that you have provided the height to Grid in percentage. This percentage value is caused this issue. So please provide the static number to Grid height instead of using the percentage(like as following code snippet), 

 
<ejs-grid #grid [dataSource]='data' [enableVirtualization]='true' height=500> 
     
</ejs-grid> 

We have attached the demo virtualization sample with this update for your reference and you can find that demo in the below link, 


Regards, 
Madhu Sudhanan P 


Hi,

I changed my code as you mentioned. It's working without that white space issue. But there are two problem, can not see in difference screen resolutions. Grid will reduce the size when open in high resolution screen. Second one is when scrolling vertically, there is some lagging on it. How can I solve that issues? 

Thank you very much for your support.


MS Madhu Sudhanan P Syncfusion Team March 28, 2019 01:02 PM UTC

Hi Neo, 

Query #1: Grid will reduce the size when open in high resolution screen 
 
From your query we found that you want to render the Grid in different screen resolution in same size. To achieve this we need to provide the Grid height in percentage. Unfortunately there is a bug in using this and we have logged a defect report for “Virtualscroll is not working properly when set the Grid height as percentage” this issue. The fix for this issue will be included in our upcoming April 10, 2019 patch release. 
 
You can now track the current status of your request, review the proposed resolution timeline, and contact us for any further inquiries through this link. 
 
https://www.syncfusion.com/feedback/5451 
 
For now we have prepared the workaround to provide the Grid height in percentage. So, after using this workaround you can provide percentage value to Grid height. Please refer the below code snippet, 
 
<div style="height:500px"> // provided the parent height 
    <ejs-grid #grid [dataSource]='data' [enableVirtualization]='true' (dataBound)="dataBound($event)" height='100%' [pageSettings]="initialPage"> 
         
              ... 
 
   </ejs-grid> 
</div> 
 
   export class VirtualizationComponent implements OnInit { 
        public ngOnInit(): void { 
            datasource(); 
            this.data = virtualData; 
            this.initialPage = { pageSize: 50 }; 
        } 
 
        dataBound(args) { 
            let isInitialRender = true; 
            if (isInitialRender) { 
                isInitialRender = false; 
                (this.grid.contentModule as any).virtualEle.adjustTable(0, 0); 
            } 
        } 
    } 
 
Note: We must need to provide height for the Grid parent when we provide the Grid height in percentage. Also, we must need to provide the pageSettings to Grid while using this workaround. 
 
 
Query #2: Second one is when scrolling vertically, there is some lagging on it 
 
From your code we found that you have used queryCellInfo event to render the tooltip in Grid cell. We suspect that this queryCellInfo action maybe caused this issue. Because, this event will trigger for each and every Grid content cell on the cell rendering time. So please ensure this issue after removing the queryCellInfo event from Grid. Also, If you want to show the tooltip in Grid cell then we suggest to use Grid cell clipMode property to achieve this requirement instead of using queryCellInfo event. 
 
Still if you are facing the same issue, please share the following details for further assistance, 
 
1)      Share the screen resolution and approximate rows and columns count in grid. 
2)      Share the queryCellInfo event code. 
3)      Syncfusion package version. 
4)      If possible try to reproduce the reported issue in our demo and send back to use. This will help us to provide the solution as early as possible. 
 
Regards, 
Madhu Sudhanan P 



NE Neo March 29, 2019 06:26 AM UTC

Hi Madhu,

Query #1: Didn't work. Included code and attached screen shots below, (Also .ts code modified. That is not included) Note: Some screenshot areas were deleted for privacy.

<div class="mdl-cell mdl-cell--3-col">

div>
<div class="mdl-cell mdl-cell--9-col">
<div class="mdl-grid mdl-grid--no-spacing">

<div class="mdl-cell mdl-cell--12-col">

<div style="height:550px">
<ejs-grid #dataGrid [dataSource]='data' [columns]='columns'
[filterSettings]='filterSettings' [contextMenuItems]='contextMenuItems'
[editSettings]='editSettings' height='100%' [toolbar]='toolbar'
(toolbarClick)="toolbarClicked($event)" (cellEdit)="cellEdit($event)"
(beforeBatchAdd)="beforeBatchAdd($event)" (beforeBatchSave)="beforeBatchSave($event)"
(queryCellInfo)='cellTooltip($event)'
(excelHeaderQueryCellInfo)='excelHeaderExporting($event)'
(excelQueryCellInfo)='excelCellExporting($event)' (dataBound)="dataBound()"
[pageSettings]="pageSettings" [enableVirtualization]='true'>
ejs-grid>
div>

<ng-template #gridCheckBoxTemplate let-data>
<ejs-checkbox [disabled]='disabled' [checked]='data.checked'
(change)="gridCheckBoxChanged($event, data)">ejs-checkbox>
ng-template>
<ng-template let-column #gridTemp1>
<ejs-checkbox>ejs-checkbox>
ng-template>
<ng-template let-column #gridTemplate2 let-data>
<img src="assets/icon.PNG" (click)="gridClicked(data)">
ng-template>

div>

div>
div>



Captured in High Resolution



Captured in Low Resolution





TS Thavasianand Sankaranarayanan Syncfusion Team April 2, 2019 10:08 AM UTC

Hi Neo, 

Thanks for the update. 

Unfortunately we are unable to reproduce the reported issue at our end. So, we have prepared the sample based on your screenshot and attached that sample in the below link for your reference. 


If possible, please try to reproduce the reported issue in this sample and send back to us. This will help us to provide the solution for this issue as early as possible.  

From your screenshot we found that “No records to display” message was displayed in Grid. Please share details about whether you have hidden the Grid data’s for your privacy or do you have faced any issues in Grid data binding. Also please ensure any blank screen issue will occur in Grid while perform scroll action. 

Regards, 
Thavasianand S. 



TS Thavasianand Sankaranarayanan Syncfusion Team April 25, 2019 05:31 AM UTC

Hi Isanka, 
 
Thanks for your patience. 
We are glad to announce that our Essential JavaScript 2 patch release (17.1.40) has been rolled out successfully and in that release, we have added the fix for an issue “Virtualscroll is not working properly when set the Grid height as percentage”. 
 
Regards, 
Thavasianand S. 



NE Neo replied to Thavasianand Sankaranarayanan April 25, 2019 01:07 PM UTC

Hi Isanka, 
 
Thanks for your patience. 
We are glad to announce that our Essential JavaScript 2 patch release (17.1.40) has been rolled out successfully and in that release, we have added the fix for an issue “Virtualscroll is not working properly when set the Grid height as percentage”. 
 
Regards, 
Thavasianand S. 


Hi Thavasianand,

I installed the version 17.1.42 and tried to enable virtualization. But It didn't work. Still has the same issue. Code as below,

<ejs-grid #Grid [dataSource]='Data' [columns]='Columns' height='100%'
[filterSettings]='FilterSettings' [contextMenuItems]='ContextMenuItems'
[editSettings]='EditSettings' [toolbar]='Toolbar'
(toolbarClick)="ToolbarClicked($event)" (contextMenuClick)='ContextMenuClicked($event)'
(cellEdit)="CellEdit($event)" (beforeBatchAdd)="BeforeBatchAdd($event)"
(beforeBatchSave)="BeforeBatchSave($event)"
(excelHeaderQueryCellInfo)='ExcelHeaderQueryCellInfo($event)'
(queryCellInfo)='QueryCellInfo($event)' (excelQueryCellInfo)='ExcelQueryCellInfo($event)'
(excelExportComplete)='ExcelExportComplete()' (dataBound)="DataBound()"
[pageSettings]="PageSettings" [enableVirtualization]='true'>
</ejs-grid>

Also I'm getting Console error like below,

ERROR TypeError: Cannot read property 'blockIndexes' of undefined


HJ Hariharan J V Syncfusion Team April 26, 2019 09:28 AM UTC

Hi Neo, 

Query #1: I installed the version 17.1.42 and tried to enable virtualization. But It didn't work. Still has the same issue. 

We are unable to reproduce this issue in our latest version. We suspect that you did not provide the parent element for the Grid. We must need to provide parent element to Grid when we provide height in percentage. Please refer the below code snippet, 

<div style="height: 400px"> 
    <ejs-grid #grid [dataSource]='data' [enableVirtualization]='true' height='100%'> 
         
    </ejs-grid> 
</div> 

Query #2: ERROR TypeError: Cannot read property 'blockIndexes' of undefined 

We are unable to reproduce this issue at our end. Please share the full stack trace of the issue. This will help us to provide the solution for this issue as early possible. 

Regards, 
Hariharan 



NE Neo replied to Hariharan J V July 12, 2019 06:23 AM UTC

Hi Neo, 

Query #1: I installed the version 17.1.42 and tried to enable virtualization. But It didn't work. Still has the same issue. 

We are unable to reproduce this issue in our latest version. We suspect that you did not provide the parent element for the Grid. We must need to provide parent element to Grid when we provide height in percentage. Please refer the below code snippet, 

<div style="height: 400px"> 
    <ejs-grid #grid [dataSource]='data' [enableVirtualization]='true' height='100%'> 
         
    </ejs-grid> 
</div> 

Query #2: ERROR TypeError: Cannot read property 'blockIndexes' of undefined 

We are unable to reproduce this issue at our end. Please share the full stack trace of the issue. This will help us to provide the solution for this issue as early possible. 

Regards, 
Hariharan 


Hi,

I'm still facing this problem and updated Syncfusion modules to latest. Please help to resolve this problem.

Thanks.


TS Thavasianand Sankaranarayanan Syncfusion Team July 15, 2019 12:36 PM UTC

Hi Neo, 

We are unable to reproduce the 'blockIndexes' of undefined issue in our latest version. So, please share the below details to us. This will help us to provide a better solution for the reported issue as early as possible. 

  1. Please share the screenshot of the issue (to know the full stack trace).
  2. If possible, please share the issue reproducible sample to us.

Regards, 
Thavasianand S. 



NE Neo replied to Thavasianand Sankaranarayanan July 17, 2019 07:43 AM UTC

Hi Neo, 

We are unable to reproduce the 'blockIndexes' of undefined issue in our latest version. So, please share the below details to us. This will help us to provide a better solution for the reported issue as early as possible. 

  1. Please share the screenshot of the issue (to know the full stack trace).
  2. If possible, please share the issue reproducible sample to us.

Regards, 
Thavasianand S. 


Hi Thavasianand,

ERROR TypeError: Cannot read property 'blockIndexes' of undefined

Above error has been fixed. That was my fault and my apologies. But still not working the virtualization feature. When it enable, the grid showing some empty spaces top and the bottom while scrolling. (Screen shoot attached)

Used this method you mentioned.

<div style="height400px"> 
    <ejs-grid #grid [dataSource]='data' [enableVirtualization]='true' height='100%'> 
         
    </ejs-grid> 
</div> 



Screen shot

https://i.imgur.com/Sqxa24r.jpg


SS Seeni Sakthi Kumar Seeni Raj Syncfusion Team July 18, 2019 10:10 AM UTC

Hi Isanka,  

Thanks for the update.  

The root cause of the problem is the ‘height’ property mentioned in percentage. Virtualization works only when the height is given on the pixels. Refer to the limitations listed out in the following Help Documentation.  


Regards,  
Seeni Sakthi Kumar S.

Loader.
Live Chat Icon For mobile
Up arrow icon