Giter VIP home page Giter VIP logo

Comments (2)

fangsmile avatar fangsmile commented on September 27, 2024

你最好用事件sort_click
给透视维度表的指标设置sort: true,显示排序图标但是实际排序不生效, 这个是怎么配置的呢 可以复现吗 @blngblng

from vtable.

blngblng avatar blngblng commented on September 27, 2024

后面改成sort_click了,给透视维度表的指标设置sort: true,显示排序图标但是实际排序不生效的例子大概是下面这样,行头的生效的,但是指标不生效。我在这里补充了提问。 @fangsmile
#2278

示例代码
`
let tableInstance;

const data = [
{row1:'2024-08-01', row2:'周六', Quantity1:'1', Sales1:'4', Quantity2:'2', Sales2:'2'},
{row1:'2024-08-03', row2:'周四', Quantity1:'2', Sales1:'3', Quantity2:'2', Sales2:'2'},
{row1:'2024-08-07', row2:'周三', Quantity1:'3', Sales1:'2', Quantity2:'2', Sales2:'2'},
{row1:'2024-08-09', row2:'周二', Quantity1:'4', Sales1:'1', Quantity2:'2', Sales2:'2'},
]
const option = {
records: data,
rows: [
{
dimensionKey: 'row1',
title: '日期',
sort: true,
headerStyle: {
textStick: true
},
width: 'auto'
},
{
dimensionKey: 'row2',
title: '星期',
sort: true,
headerStyle: {
textStick: true
},
width: 'auto'
}
],
columns: [
{
dimensionKey: 'data',
title: '销售情况',
headerStyle: {
textStick: true
},
width: 'auto'
},
],
columnTree: [
{
dimensionKey: 'data',
value: '商品1',
virtual: true,
children:[
{indicatorKey: 'Quantity1',},
{indicatorKey: 'Sales1',},
],
width: 'auto'
},
{
dimensionKey: 'data',
value: '商品2',
virtual: true,
children:[
{indicatorKey: 'Quantity2',},
{indicatorKey: 'Sales2',},
],
width: 'auto'
},
],
indicators: [
{
indicatorKey: 'Quantity1',
title: 'Quantity1',
width: 'auto',
headerStyle: {
fontWeight: 'normal'
},
sort:true
},
{
indicatorKey: 'Sales1',
title: 'Sales1',
width: 'auto',
headerStyle: {
fontWeight: 'normal'
},
format: rec => {
return '$' + Number(rec).toFixed(2);
},
sort:true
},
{
indicatorKey: 'Quantity2',
title: 'Quantity2',
width: 'auto',
headerStyle: {
fontWeight: 'normal'
},
},
{
indicatorKey: 'Sales2',
title: 'Sales2',
width: 'auto',
headerStyle: {
fontWeight: 'normal'
},
format: rec => {
return '$' + Number(rec).toFixed(2);
},
},
],
corner: {
titleOnDimension: 'all',
headerStyle: {
textStick: true
}
},
dataConfig: {
},
widthMode: 'standard'
};
tableInstance = new VTable.PivotTable(document.getElementById(CONTAINER_ID), option);
window['tableInstance'] = tableInstance;
`

from vtable.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.