Scroller
Encapsulates scroll functionality for a Widget. All requests for scrolling and scrolling information must go through a Widget's scrollable property.
Configs
12
Configs
12Common
Other
The element, or a selector which identifies a descendant element whose size will affect the scroll range.
The element which is to scroll. Defaults to the overflowElement of the configured widget
How to handle overflowing in the X axis.
May be:
'auto''visible''hidden''scroll''clip''hidden-scroll'Meaning scrollable from the UI but with no scrollbar, for example a grid header. Only on platforms which support this feature.true- meaning'auto'false- meaning'hidden'
How to handle overflowing in the Y axis.
May be:
'auto''visible''hidden''scroll''clip''hidden-scroll'Meaning scrollable from the UI but with no scrollbar. Only on platforms which support this feature.true- meaning'auto'false- meaning'hidden'
Configure as true to immediately sync partner scrollers when being synced by a controlling partner
instead of waiting for our own scroll event to pass the scroll on to partners.
The CSS class to add to the element when it is being scrolled.
Properties
25
Properties
25Class hierarchy
Other
The client height of the widget.
The client width of the widget.
The unique ID of this Scroller
The furthest possible scrollLeft position of the widget. Will be negative
if in writing direction is RTL.
The maximum X scrollable position of the widget.
The maximum Y scrollable position of the widget.
The overflow-x setting for the widget. true means 'auto'.
The overflow-y setting for the widget. true means 'auto'.
Configure as true to immediately sync partner scrollers when being synced by a controlling partner
instead of waiting for our own scroll event to pass the scroll on to partners.
The vertical scroll range of the widget. May be set to larger than the actual data height to enable virtual scrolling. This is how the grid extends its scroll range while only rendering a small subset of the dataset.
The natural DOM horizontal scroll position of the widget.
Note that this proceeds from 0 into negative space in RTL mode.
The horizontal scroll range of the widget.
The horizontal scroll position of the widget.
Note that this is always positive. Horizontal scrolling using the X property always proceeds
in the positive direction.
The vertical scroll position of the widget.
Misc
Functions
31
Functions
31Other
Partners this Scroller with the passed scroller in order to sync the scrolling position in the passed axes
| Parameter | Type | Description |
|---|---|---|
otherScroller | Scroller | |
axes | String | Object |
|
axes.x | Boolean | Sync horizontal scroll |
axes.y | Boolean | Sync vertical scroll |
Breaks the link between this Scroller and the passed Scroller set up by the addPartner method.
| Parameter | Type | Description |
|---|---|---|
otherScroller | Scroller | The Scroller to unlink from. |
Scrolls by the passed deltas according to the passed options.
| Parameter | Type | Description |
|---|---|---|
xDelta | Number | How far to scroll in the X axis. |
yDelta | Number | How far to scroll in the Y axis. |
options | Object | Boolean | How to scroll. May be passed as |
options.silent | Boolean | Set to |
options.animate | AnimateScrollOptions | Boolean | Number | Set to |
A promise which is resolved when the scrolling has finished.
Scrolls the passed element or Rectangle into view according to the passed options.
| Parameter | Type | Description |
|---|---|---|
element | HTMLElement | Rectangle | The element or a Rectangle in document space to scroll into view. |
options | BryntumScrollOptions | How to scroll. |
A promise which is resolved when the element has been scrolled into view.
Scrolls the passed element into view according to the passed options.
| Parameter | Type | Description |
|---|---|---|
element | HTMLElement | The element in document space to scroll into view. |
options | BryntumScrollOptions | How to scroll. |
A promise which is resolved when the element has been scrolled into view.
Scrolls to the passed position according to the passed options.
| Parameter | Type | Description |
|---|---|---|
toX | Number | Where to scroll to in the X axis. |
toY | Number | Where to scroll to in the Y axis. |
options | Object | Boolean | How to scroll. May be passed as |
options.animate | AnimateScrollOptions | Boolean | Number | Set to |
A promise which is resolved when the scrolling has finished.
Configuration
Events
Events
5
Events
5Fired when scrolling happens on this Scroller's element. The event object is a native scroll event
with the described extra properties injected.
// Adding a listener using the "on" method
scroller.on('scroll', ({ widget, source }) => {
});| Parameter | Type | Description |
|---|---|---|
widget | Widget | The owning Widget which has been scrolled. |
source | Scroller | This Scroller |
Fired when scrolling finished on this Scroller's element. The event object is the last native scroll event
fires by the element with the described extra properties injected.
// Adding a listener using the "on" method
scroller.on('scrollEnd', ({ widget, source }) => {
});| Parameter | Type | Description |
|---|---|---|
widget | Widget | The owning Widget which has been scrolled. |
source | Scroller | This Scroller |
Event handlers
5
Event handlers
5Called when scrolling happens on this Scroller's element. The event object is a native scroll event
with the described extra properties injected.
new Scroller({
onScroll({ widget, source }) {
}
});| Parameter | Type | Description |
|---|---|---|
widget | Widget | The owning Widget which has been scrolled. |
source | Scroller | This Scroller |
Called when scrolling finished on this Scroller's element. The event object is the last native scroll event
called by the element with the described extra properties injected.
new Scroller({
onScrollEnd({ widget, source }) {
}
});| Parameter | Type | Description |
|---|---|---|
widget | Widget | The owning Widget which has been scrolled. |
source | Scroller | This Scroller |
Typedefs
4
Typedefs
4Animation options for scrolling.
| Parameter | Type | Description |
|---|---|---|
duration | Number | The number of milliseconds to animate over. |
easing | String | The name of an easing function. |
Options accepted by some scroll functions. Note that not all options are valid for all functions.
| Parameter | Type | Description |
|---|---|---|
block | start | end | center | nearest | How far to scroll the element. |
edgeOffset | Number | edgeOffset A margin around the element or rectangle to bring into view. |
animate | AnimateScrollOptions | Boolean | Number | Set to |
highlight | Boolean | function | String | Set to |
focus | Boolean | Set to |
x | Boolean | Pass as |
y | Boolean | Pass as |
maxWidth | Number | How much of the target's width to bring into view if the target is wider. |
maxHeight | Number | How much of the target's height to bring into view if the target is taller. |
viewport | Rectangle | An optional definition of the scrollable viewport if it has to differ from the actual client area of this Scroller's element. |