JavaScript/jQuery ScrollView Options
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"
,"80%"
,"inherit"
.Function
A function returning either of the above. For example:JavaScriptheight: function() { return window.innerHeight / 1.5; }
onDisposing
A function that is executed before the UI component is disposed of.
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. |
|
model | any |
Model data. Available only if you use Knockout. |
onInitialized
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. |
onOptionChanged
Name | Type | Description |
---|---|---|
model | any |
Model data. Available only if you use Knockout. |
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. |
|
name |
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. |
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. |
|
model | any |
Model data. Available only if Knockout is used. |
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. |
|
model | any |
Model data. Available only if Knockout is used. |
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 |
---|---|---|
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. |
|
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 |
Indicates whether the container's bottom boundary is reached. |
|
reachedLeft |
Indicates whether the container's left boundary is reached. |
|
reachedRight |
Indicates whether the container's right boundary is reached. |
|
reachedTop |
Indicates whether the container's top boundary is reached. |
|
scrollOffset |
The current scroll offset in the following format: { top: topOffset, left: leftOffset }. |
onUpdated
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. |
|
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 |
Indicates whether the container's bottom boundary is reached. |
|
reachedLeft |
Indicates whether the container's left boundary is reached. |
|
reachedRight |
Indicates whether the container's right boundary is reached. |
|
reachedTop |
Indicates whether the container's top boundary is reached. |
|
scrollOffset |
The current scroll offset in the following format: { top: topOffset, left: leftOffset }. |
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"
,"80%"
,"auto"
,"inherit"
.Function
A function returning either of the above. For example:JavaScriptwidth: function() { return window.innerWidth / 1.5; }