-
AI-powered Extensions
-
Data Grid
-
Tree List
-
Chat
-
HTML Editor
-
Form
-
-
Data Grids / Data Management
-
Data Grid
- Overview
-
Data Binding
-
Filtering
- Sorting
-
Editing
-
Grouping
-
Selection
- Focused Row
- Paging
-
Scrolling
-
Columns
- AI Assistant
-
Master-Detail
-
Data Summaries
-
Drag & Drop
-
Export to PDF
-
Export to Excel
- Appearance
-
Customization
- State Persistence
-
Adaptability
-
Keyboard Navigation
- Right-To-Left Support
-
Tree List
- Overview
-
Data Binding
-
Filtering
- Sorting
-
Editing
-
Selection
- Focused Row
- Paging
-
Columns
- Drag & Drop
- State Persistence
- Adaptability
-
Keyboard Navigation
-
Card View
-
Pivot Grid
- Overview
-
Data Binding
-
Field Management
-
Data Summaries
- Drill Down
- Filtering
-
Scrolling
-
Export to Excel
- Chart Integration
- Customization
- State Persistence
-
Filter Builder
-
-
Data Visualization
-
Charts
- Overview
-
Data Binding
-
Common Concepts
-
Axis
-
Aggregation
-
Tooltips
-
Selection
-
Customization
-
Zooming
-
Export
-
-
Area Charts
-
Bar Charts
- Bullet Charts
-
Doughnut Charts
-
Financial Charts
-
Funnel and Pyramid Charts
-
Line Charts
- Pareto Chart
-
Pie Charts
-
Point Charts
-
Polar and Radar Charts
-
Range Charts
- Sankey Chart
-
Sparkline Charts
-
Tree Map
-
Gauges
- Overview
-
Runtime update
-
Bar Gauge
-
Circular Gauge
-
Linear Gauge
-
Diagram
- Overview
-
Data Binding
-
Featured Shapes
-
Custom Shapes
-
Document Capabilities
-
User Interaction
- UI Customization
- Adaptability
-
-
Scheduling / Planning
-
Scheduler
- Overview
-
Data Binding
-
Views
-
Appointments
-
Timetable
- Editing
-
Grouping
- Virtual Scrolling
- Drag & Drop
-
Customization
- Adaptability
-
Gantt
- Overview
- Data Binding
-
Filtering
- Sorting
- Strip Lines
- Export to PDF
- Validation
-
Customization
-
-
Messaging
-
WYSIWYG Editor
-
Forms
-
Data Editors
- Overview
-
Common Concepts
-
Calendar
- Check Box
- Color Box
-
Date Box
-
Date Range Box
-
Number Box
- Radio Group
-
Range Selector
- Range Slider
- Slider
- Switch
- Text Area
- Text Box
-
Drop-Downs
- Autocomplete
-
Drop Down Box
-
Select Box
-
Tag Box
-
Lookup
-
Buttons
-
File Upload / File Management
-
File Manager
- Overview
-
File System Types
-
Customization
-
File Uploader
-
-
Popup and Notifications
-
Navigation
- Overview
- Accordion
-
Action Sheet
-
Context Menu
-
Menu
- Multi View
-
Drawer
-
Tab Panel
-
Tabs
-
Toolbar
-
Stepper
- Pagination
-
List
-
Tree View
- Right-to-Left Support
-
Layout
-
Tile View
- Splitter
-
Gallery
- Scroll View
- Box
- Responsive Box
-
-
Interactive Wrappers
-
Sortable
- Resizable
-
-
Progress Indicators
-
Maps
- Overview
-
Map
-
Vector Map
-
Data Binding
- Multiple Layers
-
Markers
- Legend
-
Zooming and Panning
-
Customization
-
-
Localization
Related Demos:
Your search did not match any results.
Angular Scroll View
The ScrollView is a UI component that enables a user to scroll its content. This demo shows how to display the scrollbar within a container and how to update the ScrollView content.
Backend API
<div id="scrollview-demo">
<dx-scroll-view
#scrollView
id="scrollview"
[scrollByContent]="scrollByContent"
[scrollByThumb]="scrollByThumb"
[showScrollbar]="scrollbarMode"
[bounceEnabled]="pullDown"
reachBottomText="Updating..."
(onPullDown)="updateTopContent($event)"
(onReachBottom)="updateBottomContent($event)"
>
<div id="scrollview-content" [innerHTML]="content"></div>
</dx-scroll-view>
<div class="options">
<div class="caption">Options</div>
<div class="option">
<span>Show scrollbar:</span>
<dx-select-box
id="show-scrollbar-mode"
[inputAttr]="{ 'aria-label': 'Show Scrollbar Mode' }"
[items]="showScrollbarModes"
valueExpr="value"
displayExpr="text"
[(value)]="scrollbarMode"
>
</dx-select-box>
</div>
<div class="option">
<dx-check-box
text="Update content on the ReachBottom event"
(onValueChanged)="valueChanged($event)"
[value]="true"
>
</dx-check-box>
</div>
<div class="option">
<dx-check-box
text="Update content on the PullDown event"
[(value)]="pullDown"
>
</dx-check-box>
</div>
<div class="option">
<dx-check-box text="Scroll by content" [(value)]="scrollByContent">
</dx-check-box>
</div>
<div class="option">
<dx-check-box text="Scroll by thumb" [(value)]="scrollByThumb">
</dx-check-box>
</div>
</div>
</div>
import { bootstrapApplication } from '@angular/platform-browser';
import {
ChangeDetectorRef,
Component,
ViewChild,
AfterViewInit,
enableProdMode,
provideZoneChangeDetection,
} from '@angular/core';
import { DxSelectBoxModule } from 'devextreme-angular';
import { DxCheckBoxModule, DxCheckBoxTypes } from 'devextreme-angular/ui/check-box';
import { DxScrollViewModule, DxScrollViewComponent, DxScrollViewTypes } from 'devextreme-angular/ui/scroll-view';
import { ScrollbarMode } from 'devextreme-angular/common';
import { Service } from './app.service';
if (!/localhost/.test(document.location.host)) {
enableProdMode();
}
@Component({
selector: 'demo-app',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css'],
providers: [Service],
preserveWhitespaces: true,
imports: [
DxScrollViewModule,
DxCheckBoxModule,
DxSelectBoxModule,
],
})
export class AppComponent implements AfterViewInit {
@ViewChild(DxScrollViewComponent, { static: false }) scrollView: DxScrollViewComponent;
showScrollbarModes: { text: string, value: ScrollbarMode }[] = [
{
text: 'On Scroll',
value: 'onScroll',
}, {
text: 'On Hover',
value: 'onHover',
}, {
text: 'Always',
value: 'always',
}, {
text: 'Never',
value: 'never',
},
];
content: string;
updateContentTimer: unknown;
scrollByContent = true;
scrollByThumb = true;
scrollbarMode: ScrollbarMode = this.showScrollbarModes[0].value;
pullDown = false;
constructor(service: Service, private changeDetectorRef: ChangeDetectorRef) {
this.content = service.getContent();
}
ngAfterViewInit() {
this.scrollView.instance.option('onReachBottom', this.updateBottomContent);
}
valueChanged = (data: DxCheckBoxTypes.ValueChangedEvent) => {
this.scrollView.instance.option('onReachBottom', data.value ? this.updateBottomContent : null);
};
updateContent = (args: DxScrollViewTypes.PullDownEvent | DxScrollViewTypes.ReachBottomEvent, eventName: string) => {
const updateContentText = `<br /><div>Content has been updated on the ${eventName} event.</div><br />`;
if (this.updateContentTimer) { clearTimeout(this.updateContentTimer as number); }
this.updateContentTimer = setTimeout(() => {
this.content = (eventName === 'PullDown' ? updateContentText + this.content : this.content + updateContentText);
this.changeDetectorRef.detectChanges();
args.component.release(false);
}, 500);
};
updateTopContent = (e: DxScrollViewTypes.PullDownEvent) => {
this.updateContent(e, 'PullDown');
};
updateBottomContent = (e: DxScrollViewTypes.ReachBottomEvent) => {
this.updateContent(e, 'ReachBottom');
};
}
bootstrapApplication(AppComponent, {
providers: [
provideZoneChangeDetection({ eventCoalescing: true, runCoalescing: true }),
],
});
::ng-deep #scrollview-demo {
min-height: 550px;
}
::ng-deep #scrollview {
height: auto;
position: absolute;
top: 0;
bottom: 300px;
padding: 20px;
}
::ng-deep #scrollview-content {
white-space: pre-wrap;
}
.options {
padding: 20px;
background-color: rgba(191, 191, 191, 0.15);
position: absolute;
bottom: 0;
left: 0;
right: 0;
}
.caption {
font-size: 18px;
font-weight: 500;
}
.option {
margin-top: 10px;
}
.option > span {
position: relative;
top: 2px;
margin-right: 10px;
}
::ng-deep .option > .dx-selectbox {
display: inline-block;
vertical-align: middle;
max-width: 340px;
width: 100%;
}
import { Injectable } from '@angular/core';
let content = '';
@Injectable()
export class Service {
getContent() {
for (let i = 0; i < 10; i += 1) {
content += 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.\n\n';
}
content += '<br />';
return content;
}
}
<!DOCTYPE html>
<html lang="en">
<head>
<title>DevExtreme Demo</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=5.0" />
<link rel="stylesheet" type="text/css" href="https://cdn3.devexpress.com/jslib/26.1.5/css/dx.light.css" />
</head>
<body class="dx-viewport">
<div class="demo-container">
<demo-app>Loading...</demo-app>
</div>
<script src="https://cdn.jsdelivr.net/npm/zone.js@0.16.2/bundles/zone.umd.js"></script>
<script src="./bundle.js" type="module"></script>
</body>
</html>