Update scroll.md

This commit is contained in:
方帅 2023-09-06 17:25:07 +08:00 committed by GitHub
parent 09a948767c
commit eaad880bc3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -21,8 +21,72 @@ VTable provides rich scroll style configuration items, and users can customize t
Below we show the effect of these configurations with an example: Below we show the effect of these configurations with an example:
```javascript livedemo template=vtable ```javascript livedemo template=vtable
const table =new VTable.ListTable( let tableInstance;
... fetch('https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/North_American_Superstore_data.json')
.then((res) => res.json())
.then((data) => {
const columns =[
{
"field": "Order ID",
"title": "Order ID",
"width": "auto"
},
{
"field": "Customer ID",
"title": "Customer ID",
"width": "auto"
},
{
"field": "Product Name",
"title": "Product Name",
"width": "auto"
},
{
"field": "Category",
"title": "Category",
"width": "auto"
},
{
"field": "Sub-Category",
"title": "Sub-Category",
"width": "auto"
},
{
"field": "Region",
"title": "Region",
"width": "auto"
},
{
"field": "City",
"title": "City",
"width": "auto"
},
{
"field": "Order Date",
"title": "Order Date",
"width": "auto"
},
{
"field": "Quantity",
"title": "Quantity",
"width": "auto"
},
{
"field": "Sales",
"title": "Sales",
"width": "auto"
},
{
"field": "Profit",
"title": "Profit",
"width": "auto"
}
];
const option = {
records:data,
columns,
widthMode:'standard',
theme: { theme: {
scrollStyle: { scrollStyle: {
visible:'always', visible:'always',
@ -31,7 +95,10 @@ const table =new VTable.ListTable(
hoverOn:false hoverOn:false
} }
} }
} };
tableInstance = new VTable.ListTable(document.getElementById(CONTAINER_ID), option);
window['tableInstance'] = tableInstance;
})
``` ```
## Scroll horizontally ## Scroll horizontally