|
| 1 | +--- |
| 2 | +category: examples |
| 3 | +group: Interaction |
| 4 | +title: Scrollbars In Frozen Areas |
| 5 | +cover: https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/preview/scroll-frozen.gif |
| 6 | +link: interaction/scroll-frozen |
| 7 | +option: ListTable#scrollFrozenCols |
| 8 | +--- |
| 9 | + |
| 10 | +# Scrollbars In Frozen Areas |
| 11 | + |
| 12 | +This example shows horizontal scrolling inside frozen areas (both left and right) when the total width of frozen columns exceeds the maximum frozen width. |
| 13 | + |
| 14 | +## Key Options |
| 15 | + |
| 16 | +- `frozenColCount` / `rightFrozenColCount` set left/right frozen columns count |
| 17 | +- `maxFrozenWidth` / `maxRightFrozenWidth` set the maximum frozen area width |
| 18 | +- `scrollFrozenCols` / `scrollRightFrozenCols` enable horizontal scrolling inside frozen areas |
| 19 | +- `theme.scrollStyle.visible` can be used to observe scrollbar visibility behavior across multiple scrollable regions (e.g. `scrolling` / `focus`) |
| 20 | + |
| 21 | +## Code |
| 22 | + |
| 23 | +```javascript livedemo template=vtable |
| 24 | +let tableInstance; |
| 25 | +fetch('https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/North_American_Superstore_data.json') |
| 26 | + .then(res => res.json()) |
| 27 | + .then(data => { |
| 28 | + const columns = [ |
| 29 | + { field: 'Order ID', title: 'Order ID', width: 160 }, |
| 30 | + { field: 'Customer ID', title: 'Customer ID', width: 160 }, |
| 31 | + { field: 'Product Name', title: 'Product Name', width: 220 }, |
| 32 | + { field: 'Category', title: 'Category', width: 140 }, |
| 33 | + { field: 'Sub-Category', title: 'Sub-Category', width: 160 }, |
| 34 | + { field: 'Region', title: 'Region', width: 120 }, |
| 35 | + { field: 'City', title: 'City', width: 140 }, |
| 36 | + { field: 'Order Date', title: 'Order Date', width: 140 }, |
| 37 | + { field: 'Region', title: 'Region', width: 120 }, |
| 38 | + { field: 'City', title: 'City', width: 140 }, |
| 39 | + { field: 'Order Date', title: 'Order Date', width: 140 }, |
| 40 | + { field: 'Quantity', title: 'Quantity', width: 120 }, |
| 41 | + { field: 'Sales', title: 'Sales', width: 120 }, |
| 42 | + { field: 'Profit', title: 'Profit', width: 120 }, |
| 43 | + { field: 'Segment', title: 'Segment', width: 140 }, |
| 44 | + { field: 'Ship Mode', title: 'Ship Mode', width: 140 } |
| 45 | + ]; |
| 46 | + |
| 47 | + const option = { |
| 48 | + records: data, |
| 49 | + columns, |
| 50 | + widthMode: 'standard', |
| 51 | + frozenColCount: 4, |
| 52 | + rightFrozenColCount: 4, |
| 53 | + maxFrozenWidth: 320, |
| 54 | + maxRightFrozenWidth: 320, |
| 55 | + scrollFrozenCols: true, |
| 56 | + scrollRightFrozenCols: true, |
| 57 | + overscrollBehavior: 'none' |
| 58 | + }; |
| 59 | + tableInstance = new VTable.ListTable(document.getElementById(CONTAINER_ID), option); |
| 60 | + window['tableInstance'] = tableInstance; |
| 61 | + }); |
| 62 | +``` |
0 commit comments