React ScrollView Props
See Also
bounceEnabled
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.
elementAttr
Specifies the global attributes to be attached to the UI component's container element.
jQuery
$(function(){ $("#scrollViewContainer").dxScrollView({ // ... elementAttr: { id: "elementId", class: "class-name" } }); });
Angular
<dx-scroll-view ... [elementAttr]="{ id: 'elementId', class: 'class-name' }"> </dx-scroll-view>
import { DxScrollViewModule } from "devextreme-angular"; // ... export class AppComponent { // ... } @NgModule({ imports: [ // ... DxScrollViewModule ], // ... })
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
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
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.
Name | Type | Description |
---|---|---|
element |
The UI component's container. It is an HTML Element or a jQuery Element when you use jQuery. |
|
component |
The UI component's instance. |
onInitialized
Name | Type | Description |
---|---|---|
element |
The UI component's container. It is an HTML Element or a jQuery Element when you use jQuery. |
|
component |
The UI component's instance. |
Angular
<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
<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
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
onOptionChanged
Name | Type | Description |
---|---|---|
value | any |
The modified property's new value. |
previousValue | any |
The UI component's previous value. |
name |
The modified property if it belongs to the first level. Otherwise, the first-level property it is nested into. |
|
fullName |
The path to the modified property that includes all parent properties. |
|
element |
The UI component's container. It is an HTML Element or a jQuery Element when you use jQuery. |
|
component |
The UI component's instance. |
The following example shows how to subscribe to component property changes:
jQuery
$(function() { $("#scrollViewContainer").dxScrollView({ // ... onOptionChanged: function(e) { if(e.name === "changedProperty") { // handle the property change here } } }); });
Angular
<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
<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
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.
Name | Type | Description |
---|---|---|
component |
The UI component's instance. |
|
element |
The UI component's container. It is an HTML Element or a jQuery Element when you use jQuery. |
The function passed to this property should contain a call to the release() method, which releases the scroll view.
var scrollViewOptions = { onPullDown: function(options){ . . . options.component.release(); } }
onReachBottom
Name | Type | Description |
---|---|---|
component |
The UI component's instance. |
|
element |
The UI component's container. It is an HTML Element or a jQuery Element when you use jQuery. |
The function passed to this property should contain a call to the release() method, which releases the scroll view.
var scrollViewOptions = { onReachBottom: function(options){ . . . options.component.release(); } }
onScroll
Name | Type | Description |
---|---|---|
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 |
The UI component's container. It is an HTML Element or a jQuery Element when you use jQuery. |
|
component |
The UI component's instance. |
|
scrollOffset | any |
The current scroll offset in the following format: { top: topOffset, left: leftOffset }. |
reachedTop |
Indicates whether the container's top boundary is reached. |
|
reachedRight |
Indicates whether the container's right boundary is reached. |
|
reachedLeft |
Indicates whether the container's left boundary is reached. |
|
reachedBottom |
Indicates whether the container's bottom boundary is reached. |
onUpdated
Name | Type | Description |
---|---|---|
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 |
The UI component's container. It is an HTML Element or a jQuery Element when you use jQuery. |
|
component |
The UI component's instance. |
|
scrollOffset | any |
The current scroll offset in the following format: { top: topOffset, left: leftOffset }. |
reachedTop |
Indicates whether the container's top boundary is reached. |
|
reachedRight |
Indicates whether the container's right boundary is reached. |
|
reachedLeft |
Indicates whether the container's left boundary is reached. |
|
reachedBottom |
Indicates whether the container's bottom boundary is reached. |
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.
rtlEnabled
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.
DevExpress.config({ rtlEnabled: true });
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
scrollByThumb
Specifies whether a user can scroll the content with the scrollbar. Applies only if useNative is false.
showScrollbar
Setting this property makes sense only when the useNative property is set to false.
width
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.
If you have technical questions, please create a support ticket in the DevExpress Support Center.