React ScrollView Props

An object defining configuration properties for the ScrollView UI component.

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.

Default Value: '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.

Selector: ElementAttr
Type:

Object

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", "20vh", "80%", "inherit".

  • Function (deprecated since v21.2)
    Refer to the W0017 warning description for information on how you can migrate to viewport units.

onDisposing

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

Type:

Function

Function parameters:

Information about the event.

Object structure:
Name Type Description
model any

The model data. Available only if you use Knockout.

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.

Default Value: null

onInitialized

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

Type:

Function

Function parameters:

Information about the event.

Object structure:
Name Type Description
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.

Default Value: null

Angular
app.component.html
app.component.ts
<dx-scroll-view ...
    (onInitialized)="saveInstance($event)">
</dx-scroll-view>
import { Component } from "@angular/core";
import ScrollView from "devextreme/ui/data_grid";
// ...
export class AppComponent {
    scrollViewInstance: ScrollView;
    saveInstance (e) {
        this.scrollViewInstance = e.component;
    }
}
Vue
App.vue (Options API)
App.vue (Composition API)
<template>
    <div>
        <DxScrollView ...
            @initialized="saveInstance">
        </DxScrollView>
    </div>
</template>

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

export default {
    components: {
        DxScrollView
    },
    data: function() {
        return {
            scrollViewInstance: null
        };
    },
    methods: {
        saveInstance: function(e) {
            this.scrollViewInstance = e.component;
        }
    }
};
</script>
<template>
    <div>
        <DxScrollView ...
            @initialized="saveInstance">
        </DxScrollView>
    </div>
</template>

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

let scrollViewInstance = null;

const saveInstance = (e) => {
    scrollViewInstance = e.component;
}
</script>
React
App.js
import ScrollView from 'devextreme-react/scroll-view';

class App extends React.Component {
    constructor(props) {
        super(props);

        this.saveInstance = this.saveInstance.bind(this);
    }

    saveInstance(e) {
        this.scrollViewInstance = e.component;
    }

    render() {
        return (
            <div>
                <ScrollView onInitialized={this.saveInstance} />
            </div>
        );
    }
}
See Also
jQuery
  • Get a UI component Instance in jQuery
Angular
  • Get a UI component Instance in Angular
Vue
  • Get a UI component Instance in Vue
React
  • Get a UI component Instance in React

onOptionChanged

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

Type:

Function

Function parameters:

Information about the event.

Object structure:
Name Type Description
value any

The modified property's new value.

previousValue any

The UI component's previous value.

name

String

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

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.

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:

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:

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:

Information about the event.

Object structure:
Name Type Description
model any

Model data. Available only if Knockout is used.

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.

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.

scrollOffset any

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

reachedTop

Boolean

Indicates whether the container's top boundary is reached.

reachedRight

Boolean

Indicates whether the container's right boundary is reached.

reachedLeft

Boolean

Indicates whether the container's left boundary is reached.

reachedBottom

Boolean

Indicates whether the container's bottom boundary is reached.

Default Value: null

onUpdated

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

Type:

Function

Function parameters:

Information about the event.

Object structure:
Name Type Description
model any

Model data. Available only if Knockout is used.

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.

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.

scrollOffset any

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

reachedTop

Boolean

Indicates whether the container's top boundary is reached.

reachedRight

Boolean

Indicates whether the container's right boundary is reached.

reachedLeft

Boolean

Indicates whether the container's left boundary is reached.

reachedBottom

Boolean

Indicates whether the container's bottom boundary is reached.

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", "20vw", "80%", "auto", "inherit".

  • Function (deprecated since v21.2)
    Refer to the W0017 warning description for information on how you can migrate to viewport units.