Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: async lazy data #641

Merged
merged 9 commits into from
Nov 30, 2023
Merged
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"changes": [
{
"comment": "feat: add setRecordChildren to lazy load tree node\n\n",
"type": "none",
"packageName": "@visactor/vtable"
}
],
"packageName": "@visactor/vtable",
"email": "[email protected]"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"changes": [
{
"comment": "feat: pivot table support editable\n\n",
"type": "none",
"packageName": "@visactor/vtable"
}
],
"packageName": "@visactor/vtable",
"email": "[email protected]"
}
2 changes: 1 addition & 1 deletion docs/assets/demo/en/business/sales-bubble.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
category: examples
group: business
group: Business
title: Sales bubble chart
cover: https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/preview/sales-bubble.png
link: '../guide/custom_define/custom_render'
Expand Down
156 changes: 156 additions & 0 deletions docs/assets/demo/en/edit/pivot-table-editor.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
---
category: examples
group: table-type
title: pivot table edit data
cover: https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/preview/pivot-table-editor.gif
link: '../guide/edit/edit_cell'
option: PivotTable#editor
---

# pivot table edit data

Pivot table editing data, this example enters editing mode when the mouse is clicked.

## Key Configurations

- `VTable.register.editor` registration editor
- `editor` sets the editor registration name
- `editCellTrigger` sets the time to enter editing interaction

## Code demo

```javascript livedemo template=vtable

let tableInstance;
const input_editor = new VTable_editors.InputEditor();
VTable.register.editor('input-editor', input_editor);
fetch('https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/North_American_Superstore_Pivot_Chart_data.json')
.then((res) => res.json())
.then((data) => {

const option = {
records:data,
"rows": [
{
"dimensionKey": "Category",
"title": "Category",
"headerStyle": {
"textStick": true
},
"width": "auto",
},
{
"dimensionKey": "Sub-Category",
"title": "Sub-Catogery",
"headerStyle": {
"textStick": true
},
"width": "auto",
},
],
"columns": [
{
"dimensionKey": "Region",
"title": "Region",
"headerStyle": {
"textStick": true
},
"width": "auto",
},
{
"dimensionKey": "Segment",
"title": "Segment",
"headerStyle": {
"textStick": true
},
"width": "auto",
},
],
"indicators": [
{
"indicatorKey": "Quantity",
"title": "Quantity",
"width": "auto",
"showSort": false,
"headerStyle":{
fontWeight: "normal",
},
style:{
padding:[16,28,16,28],
color(args){
if(args.dataValue>=0)
return 'black';
return 'red'
}
}
},
{
"indicatorKey": "Sales",
"title": "Sales",
"width": "auto",
"showSort": false,
"headerStyle":{
fontWeight: "normal",
},
"format":(rec)=>{return '$'+Number(rec).toFixed(2)},
style:{
padding:[16,28,16,28],
color(args){
if(args.dataValue>=0)
return 'black';
return 'red'
}
}
},
{
"indicatorKey": "Profit",
"title": "Profit",
"width": "auto",
"showSort": false,
"headerStyle":{
fontWeight: "normal",
},
"format":(rec)=>{return '$'+Number(rec).toFixed(2)},
style:{
padding:[16,28,16,28],
color(args){
if(args.dataValue>=0)
return 'black';
return 'red'
}
}
}
],
"corner": {
"titleOnDimension": "row",
"headerStyle": {
"textStick": true
}
},
dataConfig: {
sortRules: [
{
sortField: 'Category',
sortBy: ['Office Supplies', 'Technology','Furniture']
}
],
totals: {
row: {
showSubTotals: true,
subTotalsDimensions: ['Category'],
subTotalLabel: 'subtotal'
}
}
},
enableDataAnalysis: true,
editor: 'input-editor',
editCellTrigger:'click',
widthMode:'standard'
};
tableInstance = new VTable.PivotTable(document.getElementById(CONTAINER_ID),option);
tableInstance.on('change_cell_value', arg => {
console.log(arg);
});
window['tableInstance'] = tableInstance;
})
```
Loading
Loading