A newer version of this page is available. Switch to the current version.

JavaScript/jQuery ScrollView Options

An object defining configuration properties for the ScrollView UI component.

See Also

bounceEnabled

A Boolean value specifying whether to enable or disable the bounce-back effect.

Type:

Boolean

Default Value: true, false (desktop)

If the property is set to true, you can scroll the UI component content up (down) even if you have reached the bottom (top) boundary. But when you release the content, it returns to the bound position. If the property value is false, you can scroll the UI component content until you reach the boundary.

direction

A string value specifying the available scrolling directions.

Type:

String

Default Value: 'vertical'
Accepted Values: 'both' | 'horizontal' | 'vertical'

disabled

Specifies whether the UI component responds to user interaction.

Type:

Boolean

Default Value: false

elementAttr

Specifies the global attributes to be attached to the UI component's container element.

Type: any
Default Value: {}

jQuery
$(function(){
    $("#scrollViewContainer").dxScrollView({
        // ...
        elementAttr: {
            id: "elementId",
            class: "class-name"
        }
    });
});
Angular
HTML
TypeScript
<dx-scroll-view ...
    [elementAttr]="{ id: 'elementId', class: 'class-name' }">
</dx-scroll-view>
import { DxScrollViewModule } from "devextreme-angular";
// ...
export class AppComponent {
    // ...
}
@NgModule({
    imports: [
        // ...
        DxScrollViewModule
    ],
    // ...
})
Vue
App.vue
<template>
    <DxScrollView ...
        :element-attr="scrollViewAttributes">
    </DxScrollView>
</template>

<script>
import DxScrollView from 'devextreme-vue/scroll-view';

export default {
    components: {
        DxScrollView
    },
    data() {
        return {
            scrollViewAttributes: {
                id: 'elementId',
                class: 'class-name'
            }
        }
    }
}
</script>
React
App.js
import React from 'react';

import ScrollView from 'devextreme-react/scroll-view';

class App extends React.Component {
    scrollViewAttributes = {
        id: 'elementId',
        class: 'class-name'
    }

    render() {
        return (
            <ScrollView ...
                elementAttr={this.scrollViewAttributes}>
            </ScrollView>
        );
    }
}
export default App;

height

Specifies the UI component's height.

Type:

Number

|

String

|

Function

Return Value:

Number

|

String

The UI component's height.

Default Value: undefined

This property accepts a value of one of the following types:

  • Number
    The height in pixels.

  • String
    A CSS-accepted measurement of height. For example, "55px", "80%", "inherit".

  • Function
    A function returning either of the above. For example:

    JavaScript
    height: function() {
        return window.innerHeight / 1.5;
    }

onDisposing

A function that is executed before the UI component is disposed of.

Type:

Function

Function parameters:
e:

Object

Information about the event.

Object structure:
Name Type Description
component

ScrollView

The UI component's instance.

element

HTMLElement | jQuery

The UI component's container. It is an HTML Element or a jQuery Element when you use jQuery.

model any

Model data. Available only if you use Knockout.

Default Value: null

onInitialized

A function used in JavaScript frameworks to save the UI component instance.

Type:

Function

Function parameters:
e:

Object

Information about the event.

Object structure:
Name Type Description
component

ScrollView

The UI component's instance.

element

HTMLElement | jQuery

The UI component's container. It is an HTML Element or a jQuery Element when you use jQuery.

Default Value: null

See Also

onOptionChanged

A function that is executed after a UI component property is changed.

Type:

Function

Function parameters:
e:

Object

Information about the event.

Object structure:
Name Type Description
model any

Model data. Available only if you use Knockout.

fullName

String

The path to the modified property that includes all parent properties.

element

HTMLElement | jQuery

The UI component's container. It is an HTML Element or a jQuery Element when you use jQuery.

component

ScrollView

The UI component's instance.

name

String

The modified property if it belongs to the first level. Otherwise, the first-level property it is nested into.

value any

The modified property's new value.

Default Value: null

The following example shows how to subscribe to component property changes:

jQuery
index.js
$(function() {
    $("#scrollViewContainer").dxScrollView({
        // ...
        onOptionChanged: function(e) {
            if(e.name === "changedProperty") {
                // handle the property change here
            }
        }
    });
});
Angular
app.component.html
app.component.ts
app.module.ts
<dx-scroll-view ...
    (onOptionChanged)="handlePropertyChange($event)"> 
</dx-scroll-view>
import { Component } from '@angular/core'; 

@Component({ 
    selector: 'app-root', 
    templateUrl: './app.component.html', 
    styleUrls: ['./app.component.css'] 
}) 

export class AppComponent { 
    // ...
    handlePropertyChange(e) {
        if(e.name === "changedProperty") { 
            // handle the property change here
        }
    }
}
import { BrowserModule } from '@angular/platform-browser'; 
import { NgModule } from '@angular/core'; 
import { AppComponent } from './app.component'; 
import { DxScrollViewModule } from 'devextreme-angular'; 

@NgModule({ 
    declarations: [ 
        AppComponent 
    ], 
    imports: [ 
        BrowserModule, 
        DxScrollViewModule 
    ], 
    providers: [ ], 
    bootstrap: [AppComponent] 
}) 

export class AppModule { }  
Vue
App.vue
<template> 
    <DxScrollView ...
        @option-changed="handlePropertyChange"
    />            
</template> 

<script>  
import 'devextreme/dist/css/dx.light.css'; 
import DxScrollView from 'devextreme-vue/scroll-view'; 

export default { 
    components: { 
        DxScrollView
    }, 
    // ...
    methods: { 
        handlePropertyChange: function(e) {
            if(e.name === "changedProperty") {
                // handle the property change here
            }
        }
    } 
} 
</script> 
React
App.js
import React from 'react';  
import 'devextreme/dist/css/dx.light.css'; 

import ScrollView from 'devextreme-react/scroll-view'; 

const handlePropertyChange = (e) => {
    if(e.name === "changedProperty") {
        // handle the property change here
    }
}

export default function App() { 
    return ( 
        <ScrollView ...
            onOptionChanged={handlePropertyChange}
        />        
    ); 
} 

onPullDown

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

Type:

Function

Function parameters:
e:

Object

Information about the event.

Object structure:
Name Type Description
component

ScrollView

The UI component's instance.

element

HTMLElement | jQuery

The UI component's container. It is an HTML Element or a jQuery Element when you use jQuery.

model any

Model data. Available only if Knockout is used.

Default Value: null

The function passed to this property should contain a call to the release() method, which releases the scroll view.

JavaScript
var scrollViewOptions = {
    onPullDown: function(options){
        . . .
        options.component.release();
    }
}

onReachBottom

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

Type:

Function

Function parameters:
e:

Object

Information about the event.

Object structure:
Name Type Description
component

ScrollView

The UI component's instance.

element

HTMLElement | jQuery

The UI component's container. It is an HTML Element or a jQuery Element when you use jQuery.

model any

Model data. Available only if Knockout is used.

Default Value: null

The function passed to this property should contain a call to the release() method, which releases the scroll view.

JavaScript
var scrollViewOptions = {
    onReachBottom: function(options){
        . . .
        options.component.release();
    }
}

onScroll

A function that is executed on each scroll gesture.

Type:

Function

Function parameters:
e:

Object

Information about the event.

Object structure:
Name Type Description
component

ScrollView

The UI component's instance.

element

HTMLElement | jQuery

The UI component's container. It is an HTML Element or a jQuery Element when you use jQuery.

event

Event (jQuery or EventObject)

The event that caused the function to execute. It is an EventObject or a jQuery.Event when you use jQuery.

model any

Model data. Available only if Knockout is used.

reachedBottom

Boolean

Indicates whether the container's bottom boundary is reached.

reachedLeft

Boolean

Indicates whether the container's left boundary is reached.

reachedRight

Boolean

Indicates whether the container's right boundary is reached.

reachedTop

Boolean

Indicates whether the container's top boundary is reached.

scrollOffset

Object

The current scroll offset in the following format: { top: topOffset, left: leftOffset }.

Default Value: null

onUpdated

A function that is executed each time the UI component is updated.

Type:

Function

Function parameters:
e:

Object

Information about the event.

Object structure:
Name Type Description
component

ScrollView

The UI component's instance.

element

HTMLElement | jQuery

The UI component's container. It is an HTML Element or a jQuery Element when you use jQuery.

event

Event (jQuery or EventObject)

The event that caused the function to execute. It is an EventObject or a jQuery.Event when you use jQuery.

model any

Model data. Available only if Knockout is used.

reachedBottom

Boolean

Indicates whether the container's bottom boundary is reached.

reachedLeft

Boolean

Indicates whether the container's left boundary is reached.

reachedRight

Boolean

Indicates whether the container's right boundary is reached.

reachedTop

Boolean

Indicates whether the container's top boundary is reached.

scrollOffset

Object

The current scroll offset in the following format: { top: topOffset, left: leftOffset }.

Default Value: null

pulledDownText

Specifies the text shown in the pullDown panel when pulling the content down lowers the refresh threshold.

Type:

String

Default Value: 'Release to refresh...', '' (Material)

pullingDownText

Specifies the text shown in the pullDown panel while pulling the content down to the refresh threshold.

Type:

String

Default Value: 'Pull down to refresh...', '' (Material)

reachBottomText

Specifies the text shown in the pullDown panel displayed when content is scrolled to the bottom.

Type:

String

Default Value: 'Loading...', '' (Material)

refreshingText

Specifies the text shown in the pullDown panel displayed when the content is being refreshed.

Type:

String

Default Value: 'Refreshing...', '' (Material)

rtlEnabled

Switches the UI component to a right-to-left representation.

Type:

Boolean

Default Value: false

When this property is set to true, the UI component text flows from right to left, and the layout of elements is reversed. To switch the entire application/site to the right-to-left representation, assign true to the rtlEnabled field of the object passed to the DevExpress.config(config) method.

JavaScript
DevExpress.config({
    rtlEnabled: true
});

DataGrid Demo Navigation UI Demo Editors Demo

scrollByContent

A Boolean value specifying whether or not an end-user can scroll the UI component content swiping it up or down. Applies only if useNative is false

Type:

Boolean

Default Value: true, false (non-touch devices)

scrollByThumb

Specifies whether a user can scroll the content with the scrollbar. Applies only if useNative is false.

Type:

Boolean

Default Value: false, true (desktop)

showScrollbar

Specifies when the UI component shows the scrollbar.

Type:

String

Default Value: 'onScroll', 'onHover' (desktop)
Accepted Values: 'onScroll' | 'onHover' | 'always' | 'never'

Setting this property makes sense only when the useNative property is set to false.

useNative

Indicates whether to use native or simulated scrolling.

Type:

Boolean

Default Value: true, false (desktop except Mac)

width

Specifies the UI component's width.

Type:

Number

|

String

|

Function

Return Value:

Number

|

String

The UI component's width.

Default Value: undefined

This property accepts a value of one of the following types:

  • Number
    The width in pixels.

  • String
    A CSS-accepted measurement of width. For example, "55px", "80%", "auto", "inherit".

  • Function
    A function returning either of the above. For example:

    JavaScript
    width: function() {
        return window.innerWidth / 1.5;
    }