VTable icon indicating copy to clipboard operation
VTable copied to clipboard

[BUG] 透视表,自定义columnTree表头之后,点击指标不能排序

Open yzhang921 opened this issue 3 months ago • 4 comments

重现: 在自定义表头案例中 设置indicator中字段sort:true, showSort: true, 排序图标出现,但是不能排序 请问是使用方法不对吗?

yzhang921 avatar Sep 29 '25 03:09 yzhang921

https://www.visactor.io/vtable/guide/data_analysis/pivot_table_dataAnalysis 看教程

fangsmile avatar Sep 30 '25 02:09 fangsmile

看了好几遍,没看懂啊,能给条明路不

yzhang921 avatar Sep 30 '25 03:09 yzhang921

为啥,下面的配置就能正常排序

let tableInstance;
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',
          sort: true
        },
        {
          dimensionKey: 'Sub-Category',
          title: 'Sub-Catogery',
          sort: true
        }
      ],
      columns: ['Region', 'Segment'],
      indicators: [
        {
          indicatorKey: 'Sales',
          title: 'Sales',
          sort: true,
        },
        {
          indicatorKey: 'Profit',
          title: 'Profit',
          sort: true,
        }
      ],
      corner: {
        titleOnDimension: 'row',
        headerStyle: {
          textStick: true
        }
      },
      defaultColWidth: 130
    };
    tableInstance = new VTable.PivotTable(document.getElementById(CONTAINER_ID), option);
    window['tableInstance'] = tableInstance;
  });

yzhang921 avatar Sep 30 '25 03:09 yzhang921

更新,经测试发现

  1. columnHierarchyType: 'grid-tree' 时无法排序,
  2. 自定义columnTree的时候,无法排序

yzhang921 avatar Oct 15 '25 09:10 yzhang921