Hi
Nguyen,
Greetings from Syncfusion
support.
After reviewing your query,
we could see that you want to turn on or off the virtualization feature in the
Grid dynamically. We have created a sample based on your requirement where we
handled the on off of virtualization in the Grid through button click. We have
logged console the currentViewData length this will return the whole data when
virtualization is disabled otherwise will return only the viewport data other
data are returned upon scrolling. To enable virtualization in the Grid we need
to inject virtualScrollService and to define the height of the Grid. Please refer to
the below code example, sample, video demo and documentation link for detailed
information.
|
App.component.html
<button ejs-button id="btn" #ButtonInstance (click)="btnClick()" style="margin-bottom: 20px;">Enable/Disable Virtualization</button>
App.component.ts
btnClick() {
this.grid.enableVirtualization = !this.grid.enableVirtualization;
if (this.grid.virtualscrollModule) {
console.log('Virtualization Disabled');
}
else {
console.log('Virtualization Enabled');
}
}
|
Sample: https://stackblitz.com/edit/angular-grid-column-initial-minwidth-xl9ard?file=src%2Fapp.component.ts,src%2Fapp.component.html,package.json
Documentation Link: virtual-scrolling
Regards
Aishwarya
R
Attachment:
Virtualization_Toggle_bf36125a.zip