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
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Custom data adapter and virtual scrolling

Thread ID:





143811 Apr 5,2019 12:51 PM UTC Apr 8,2019 04:52 AM UTC Angular - EJ 2 2
Tags: Grid
Asked On April 5, 2019 12:51 PM UTC

Because our RESTful API doesn't use the result/count response style but a flat array and `X-Total-Count` header, I figured I had to write a custom data adapter.

class ApiAdaptor extends UrlAdaptor {
  processQuery(dm: DataManager, query: Query, hierarchyFilters?: Object[]) {
    let original = super.processQuery.apply(this, arguments);
    let data = JSON.parse(original.data);

    return {
      data: JSON.stringify({ value: data }),
      url: `${original.url}?offset=${data.skip}&limit=${data.take}`,
      pvtData: original.pvtData,
      type: 'GET',
      contentType: 'application/json; charset=utf-8'

  processResponse(data, ds, query, xhr, request, changes) {
    return {
      result: super.processResponse.apply(this, arguments),
      count: xhr.getResponseHeader('X-Total-Count')

The grid component has [enableVirtualization]=true and I've loaded VirtualScrollService as a provider.

It does seem to work fine but virtual scrolling doesn't work properly with this adapter. If I scroll down, right before the point where subsequent data will be loaded and then scroll down a row further, the new data is loaded and rendered on the grid from the top down. Of course, the new data should only be rendered in the open space at the bottom. In other words: when the new data is loaded, the grid is effectively scrolled all the way to the point where the new data was loaded.

This results in a jumping grid experience.

Is there something I'm doing wrong?

Replied On April 5, 2019 01:09 PM UTC

Well, it turned out that I wasn't loading the ej2 style properly. I loaded it from the component instead of globally. This probably caused the grid to calculate the grid size incorrectly, thus causing the jumpy scrolling.

Pavithra Subramaniyam [Syncfusion]
Replied On April 8, 2019 04:52 AM UTC

Hi Sandor, 
Thanks for contacting Syncfusion support. 
We are happy to hear that your issue has been resolved. 
Please contact us if you need any further assistance. 
Pavithra S. 


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon