This is a migrated thread and some comments may be shown as answers.

Virtual Scrolling and auto numbering a grid col

2 Answers 31 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Philip
Top achievements
Rank 1
Philip asked on 08 Mar 2017, 05:51 PM

I'm working on a project that is using the kendoGrid and odata service with virtual scrolling enabled.

 

The data we are pulling into the the grid doesn't use a traditional id number for it's primary key, so to have something that looks like an id number in the table we created an id column and append the number via a column template, which looks like this.

 

let _columns = [{

   field: 'rowNumberer',
   title: '#',
   template: '#= ++rowNumber #',
   width: 30
}

 

So the issue we are having is that as you scroll down the page the number increments fine, but it's also increments when you scroll up which throws the count off.

Is there another way to handle this?

2 Answers, 1 is accepted

Sort by
0
Dimiter Topalov
Telerik team
answered on 09 Mar 2017, 02:27 PM
Hello Philip,

Unfortunately, the desired functionality is not supported, because the Grid virtual scrolling functionality relies on a complex fetching and prefetching mechanism to ensure better and smoother user experience while scrolling, thus making all calculations regarding the current page and the actual items currently fetched from the server, unreliable.

Furthermore, if the user moves the scrollbar handle instead of scrolling with the mouse wheel, results would be totally different.

The only reliable way to show consecutive numbers would be to provide such to each item on the server. Detailed information about the Grid virtual scrolling functionality, and a list of its known limitations, is available in the following sections of our documentation:

http://docs.telerik.com/kendo-ui/controls/data-management/grid/appearance#virtual-scrolling

http://docs.telerik.com/kendo-ui/controls/data-management/grid/appearance#limitations-of-virtual-scrolling

In general, we recommend using regular paging, instead of virtual scrolling, for situations, in which the virtual scrolling functionality is not applicable. For example the discussed custom numbering of the items can be easily achieved with regular paging, e.g.:

http://dojo.telerik.com/evuyU

Regards,
Dimiter Topalov
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Philip
Top achievements
Rank 1
answered on 09 Mar 2017, 03:53 PM
Okay, thanks for the feedback
Tags
Grid
Asked by
Philip
Top achievements
Rank 1
Answers by
Dimiter Topalov
Telerik team
Philip
Top achievements
Rank 1
Share this question
or