User Interaction
An end user can scroll the List with a swipe gesture and with the scrollbar. Although by default the swipe gesture is active for mobile devices and the scrollbar is active for desktops, you can force any or both of them to be used on all platforms. For this purpose, set the scrollByContent or scrollByThumb option to true.
The List employs native scrolling on most platforms, except non-Mac desktops and devices based on Android older than version 4. To employ native scrolling on all platforms without exception, assign true to the useNativeScrolling option. Note that if you assign false to this option, the List will simulate scrolling on all platforms.
If simulated scrolling is used, you can specify when to show the scrollbar. For this purpose, use the showScrollbar option.
On mobile devices, the user can pull the List to scroll it slightly further than its top or bottom boundary. Once the user releases the List, it bounces back to the boundary position. You can disable this effect using the bounceEnabled option.
If you want to disable scrolling completely, assign false to the scrollingEnabled option.
See Also
API
The following table gives an overview of scrolling-related methods exposed by the List.
Method | Description |
---|---|
scrollHeight() | Returns the height of the scrollable content in pixels. |
scrollToItem(itemIndex) | Scrolls the List to the item with a specific index. |
scrollToItem(itemElement) | Scrolls the List to a specific DOM node. |
scrollTo(location) | Scrolls the List to a location specified in pixels. |
scrollBy(distance) | Scrolls the List from the current location by a distance specified in pixels. |
scrollTop() | Returns a pixel-measured value that shows how far the List is scrolled from the top. |
The following examples shows how to call these methods.
See Also
Events
To execute certain commands when the List is scrolled, handle the scroll event. If the event handling function is not going to be changed during the lifetime of the widget, assign it to the onScroll option when you configure the widget.
If you are going to change the scroll event handler at runtime, or if you need to attach several handlers to this event, subscribe to it using the on(eventName, eventHandler) method. This approach is more typical of jQuery.
- var scrollEventHandler1 = function(e) {
- // First handler of the "scroll" event
- };
- var scrollEventHandler2 = function(e) {
- // Second handler of the "scroll" event
- };
- $("#listContainer").dxList("instance")
- .on("scroll", scrollEventHandler1)
- .on("scroll", scrollEventHandler2);
See Also
If you have technical questions, please create a support ticket in the DevExpress Support Center.