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

🐛普通表与明细表使用options.colCell时,排序icon会消失 #2391

Closed
2 of 5 tasks
yuanlllshuai opened this issue Oct 26, 2023 · 1 comment
Closed
2 of 5 tasks

Comments

@yuanlllshuai
Copy link

🏷 Version

Package Version
@antv/s2 1.51.1
@antv/s2-react 1.44.0

Sheet Type

  • PivotSheet
  • TableSheet
  • GridAnalysisSheet
  • StrategySheet
  • EditableSheet

🖋 Description

普通表与明细表使用options.colCell时,表头排序icon会消失,options.showDefaultHeaderActionIcon=true会失效,但透视表功能正常。

只用showDefaultHeaderActionIcon,排序icon正常:
image
加了colCell,排序icon消失:
image
透视表均正常:
image

⌨️ Code Snapshots

import { TableSheet } from '@antv/s2';
import { ColCell } from "@antv/s2";


class CustomColCell extends ColCell {
  getTextStyle() {
    return super.getTextStyle();
  }
}

fetch(
  'https://assets.antv.antgroup.com/s2/basic-table-mode.json',
)
  .then((res) => res.json())
  .then((data) => {
    const container = document.getElementById('container');
    const s2DataConfig = {
      fields: {
        columns: ['province', 'city', 'type', 'price', 'cost'],
      },
      meta: [
        {
          field: 'province',
          name: '省份',
        },
        {
          field: 'city',
          name: '城市',
        },
        {
          field: 'type',
          name: '商品类别',
        },
        {
          field: 'price',
          name: '价格',
        },
        {
          field: 'cost',
          name: '成本',
        },
      ],
      data,
    };

    const s2Options = {
      width: 600,
      height: 480,
      showSeriesNumber: true,
      showDefaultHeaderActionIcon: false,
      customSVGIcons: [
        {
            name: 'customKingIcon',
            svg: 'https://gw.alipayobjects.com/zos/bmw-prod/f44eb1f5-7cea-45df-875e-76e825a6e0ab.svg',
        },
      ],
        colCell: (node, spreadsheet, headerConfig) => {
            return new CustomColCell(node, spreadsheet, headerConfig);
        },
    };

    const s2 = new TableSheet(container, s2DataConfig, s2Options);

    s2.render();
  });

🔗 Reproduce Link

https://s2.antv.antgroup.com/zh/examples/basic/table/#table
https://s2.antv.antgroup.com/zh/examples/custom/custom-order/#custom-order

😊 Expected Behavior

普通表应该与透视表逻辑保持一致

💻 System information

Environment Info
System macOS 13.3.1
Browser chrome: 118.0.5993.70
@lijinke666
Copy link
Member

明细表对应 TableColCell, 这块文档有缺失, 后面会补充, 抱歉.

- import { ColCell } from "@antv/s2";
+ import { TableColCell, TableDataCell, TableSeriesCell, TableCornerCell } from "@antv/s2";


- class CustomColCell extends ColCell {}
+ class CustomColCell extends TableColCell {}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants