Vue ScrollView API

The ScrollView is a widget that enables a user to scroll its content.

import DxScrollView from "devextreme-vue/scroll-view"
Type: DxScrollViewTypes.default

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
JavaScript
HTML
$(function() {
    $("#scrollView").dxScrollView({
        height: 500,
        width: 500,
        direction: "both"
    });
});
<div id="scrollView">
    <div id="content"></div>
</div>
Angular
HTML
TypeScript
<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
HTML
<div dx-scroll-view="{
    height: 500,
    width: 500,
    direction: 'both'
}">
    <div id="content"></div>
</div>
Knockout
HTML
<div data-bind="dxScrollView: {
    height: 500,
    width: 500,
    direction: 'both'
}">
    <div id="content"></div>
</div>
ASP.NET MVC Controls
Razor C#
Razor VB
@(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

View Demo

See Also

Configuration

An object defining configuration options for the ScrollView widget.

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 function that is executed before the widget is disposed of.

onInitialized

A function used in JavaScript frameworks to save the widget instance.

onOptionChanged

A function that is executed after a widget option is changed.

onPullDown

A function that is executed when the "pull to refresh" gesture is performed. Supported in mobile themes only.

onReachBottom

A function that is executed when the content is scrolled down to the bottom.

onScroll

A function that is executed on each scroll gesture.

onUpdated

A function that is executed each time the widget is updated.

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

This section describes the members used to manipulate the widget.

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

This section describes events fired by this widget.

Name Description
disposing

Raised before the widget is disposed of.

initialized

Raised only once, after the widget is initialized.

optionChanged

Raised after a widget option is changed.

pullDown

Raised when the "pull to refresh" gesture is performed.

reachBottom

Raised when the content is scrolled down to the bottom.

scroll

Raised on each scroll gesture.

updated

Raised each time the widget is updated.

See Also