Angular ScrollView API
DevExtreme widgets are integrated with many popular libraries and frameworks. See the Installation section (for JavaScript libraries) or the Prerequisites and Installation section (for ASP.NET MVC framework) to find details on setting up DevExtreme with a particular library or framework.
The following code shows how to create the ScrollView widget using every supported library and framework. For more details on working with widgets in these libraries and frameworks, see the Widget Basics topic for jQuery, Angular, AngularJS, Knockout or ASP.NET MVC.
jQuery
$(function() { $("#scrollView").dxScrollView({ height: 500, width: 500, direction: 'both' }); });
<div id="scrollView"> <div id="content"></div> </div>
Angular
<dx-scroll-view [height]="500" [width]="500" direction="both"> <div id="content"></div> </dx-scroll-view>
import { DxScrollViewModule } from 'devextreme-angular' // ... export class AppComponent { // ... } @NgModule({ imports: [ // ... DxScrollViewModule ], // ... })
AngularJS
<div dx-scroll-view="{ height: 500, width: 500, direction: 'both' }"> <div id="content"></div> </div>
Knockout
<div data-bind="dxScrollView: { height: 500, width: 500, direction: 'both' }"> <div id="content"></div> </div>
ASP.NET MVC Controls
@(Html.DevExtreme().ScrollView() .ID("scrollView") .Height(500) .Width(500) .Direction(ScrollDirection.Both) .Content(@<text> <div id="content"></div> </text>) )
@Code Html.DevExtreme().ScrollView() _ .ID("scrollView") _ .Height(500) _ .Width(500) _ .Direction(ScrollDirection.Both) _ .Content(Sub() @<text> <div id="content"></div> </text> End Sub).Render() End Code
See Also
Configuration
Name | Description |
---|---|
bounceEnabled |
A Boolean value specifying whether to enable or disable the bounce-back effect. |
direction |
A string value specifying the available scrolling directions. |
disabled |
A Boolean value specifying whether or not the widget can respond to user interaction. |
elementAttr |
Specifies the attributes to be attached to the widget's root element. |
height |
Specifies the widget's height. |
onDisposing |
A handler for the disposing event. Executed when the widget is removed from the DOM using the remove(), empty(), or html() jQuery methods only. |
onInitialized |
A handler for the initialized event. Executed only once, after the widget is initialized. |
onOptionChanged |
A handler for the optionChanged event. Executed after an option of the widget is changed. |
onPullDown |
A handler for the pullDown event. |
onReachBottom |
A handler for the reachBottom event. |
onScroll |
A handler for the scroll event. |
onUpdated |
A handler for the update event. |
pulledDownText |
Specifies the text shown in the pullDown panel when pulling the content down lowers the refresh threshold. |
pullingDownText |
Specifies the text shown in the pullDown panel while pulling the content down to the refresh threshold. |
reachBottomText |
Specifies the text shown in the pullDown panel displayed when content is scrolled to the bottom. |
refreshingText |
Specifies the text shown in the pullDown panel displayed when the content is being refreshed. |
rtlEnabled |
Switches the widget to a right-to-left representation. |
scrollByContent |
A Boolean value specifying whether or not an end-user can scroll the widget content swiping it up or down. Applies only if useNative is false |
scrollByThumb |
A Boolean value specifying whether or not an end-user can scroll the widget content using the scrollbar. |
showScrollbar |
Specifies when the widget shows the scrollbar. |
useNative |
Indicates whether to use native or simulated scrolling. |
width |
Specifies the widget's width. |
Methods
Name | Description |
---|---|
beginUpdate() |
Prevents the widget from refreshing until the endUpdate() method is called. |
clientHeight() |
Gets the widget's height. |
clientWidth() |
Gets the widget's width. |
content() |
Gets the widget's content. |
defaultOptions(rule) |
Specifies the device-dependent default configuration options for this component. |
dispose() |
Disposes of all the resources allocated to the ScrollView instance. |
element() |
Gets the root widget element. |
endUpdate() |
Refreshes the widget after a call of the beginUpdate() method. |
getInstance(element) |
Gets the instance of a widget found using its DOM node. |
instance() |
Gets the widget's instance. Use it to access other methods of the widget. |
off(eventName) |
Detaches all event handlers from a single event. |
off(eventName, eventHandler) |
Detaches a particular event handler from a single event. |
on(eventName, eventHandler) |
Subscribes to an event. |
on(events) |
Subscribes to events. |
option() |
Gets all widget options. |
option(optionName) |
Gets the value of a single option. |
option(optionName, optionValue) |
Updates the value of a single option. |
option(options) |
Updates the values of several options. |
refresh() |
Locks the widget until the release(preventScrollBottom) method is called and executes the function passed to the onPullDown option and the handler assigned to the pullDown event. |
release(preventScrollBottom) |
Notifies the ScrollView that data loading is finished. |
scrollBy(distance) |
Scrolls the content by a specific distance. |
scrollBy(distanceObject) |
Scrolls the content by a specific distance in horizontal and vertical directions. |
scrollHeight() |
Gets the scrollable content's height in pixels. |
scrollLeft() |
Gets the left scroll offset. |
scrollOffset() |
Gets the scroll offset. |
scrollTo(targetLocation) |
Scrolls the content to a specific position. |
scrollTo(targetLocationObject) |
Scrolls the content to a specific position. |
scrollToElement(targetLocation) |
Scrolls the content to an element. |
scrollTop() |
Gets the top scroll offset. |
scrollWidth() |
Gets the scrollable content's width in pixels. |
update() |
Updates the scrollable contents' dimensions. |
Events
Name | Description |
---|---|
disposing |
Raised when the widget is removed from the DOM using the remove(), empty(), or html() jQuery methods only. |
initialized |
Raised only once, after the widget is initialized. |
optionChanged |
Raised after a widget option is changed. |
pullDown |
Fires after the widget is scrolled to the top and pulled down. |
reachBottom |
Fires after the widget is scrolled to the bottom and pulled up. |
scroll |
Fires on each scroll gesture. |
updated |
Fires after the widget is updated. |
If you have technical questions, please create a support ticket in the DevExpress Support Center.