collapse all groups when virtualization is enabled

hi, what i want to do is that i want all my grouped data to be collapsed right after grouping, but when the virtualization is enabled not all of the groups are shown . is there anything i can do ?

3 Replies 1 reply marked as answer

BS Balaji Sekar Syncfusion Team March 8, 2021 11:02 AM UTC

Hi Moorat, 
 
Greetings from the Syncfusion support. 
 
In EJ2Grid Virtualization, data’s are rendered based on the scroller position. At initial rendering, the top records only rendered in DOM. By default, the grouped records will be rendered in expanded state when we performing any action with the virtualization. Since this is the behaviour of Grid.   
 
The collapseAll() methods collapse only the current page tr element in the Grid. So, we cannot achieve your requirement at our end.  
 
Regards, 
Balaji Sekar 



MO Moorat March 8, 2021 12:26 PM UTC

thanks for your answer , but is there anyway i can at least get the info of the grouped data? like total number of groups ,etc. or its happening page by page?


BS Balaji Sekar Syncfusion Team March 9, 2021 11:50 AM UTC

Hi Moorat, 
 
Query: Is there anyway i can at least get the info of the grouped data?  
 
Based on your query we can access the Grid’s grouped column details using currentViewData it is show the grouped columns/rows details of current page. 

Please refer the below code example for more information. 
[app.component.ts] 
import { Component, OnInit, ViewChild } from "@angular/core"; 
import { L10n, setCulture } from "@syncfusion/ej2-base"; 
import { GridComponent } from "@syncfusion/ej2-angular-grids"; 
import { data } from "./data"; 
 
@Component({ 
  selector: "app-root", 
  templateUrl: "app.component.html" 
}) 
export class AppComponent { 
  @ViewChild("grid") 
  public grid: GridComponent; 
  public data: Object[]; 
  public initialPage: Object; 
 
  clickFn() { 
    console.log(this.grid.currentViewData); // Here you can get the grouped columns details 
  } 

Please get back to us, if you need further assistance. 

Regards, 
Balaji Sekar 


Marked as answer
Loader.
Up arrow icon