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

🐛明细表隐藏表头hiddenColumns更改,将部分字段取消隐藏,UI没有重新渲染 #2495

Closed
1 of 5 tasks
QJerryxjh opened this issue Jan 3, 2024 · 7 comments · Fixed by #2527
Closed
1 of 5 tasks
Assignees

Comments

@QJerryxjh
Copy link

QJerryxjh commented Jan 3, 2024

🏷 Version

Package Version
@antv/s2 1.54.2
@antv/s2-react 1.46.0

Sheet Type

  • PivotSheet
  • TableSheet
  • GridAnalysisSheet
  • StrategySheet
  • EditableSheet

🖋 Description

明细表初始指明hiddenColumnFields部分字段,重新更改hiddenColumnFields此时隐藏列并非新制定的hiddenColumnFields内列,而是取了两次hiddenColumnFields的交集

⌨️ Code Snapshots

const App = () => {
  const [data, setData] = useState([]);
  const [hiddenColumnFields, setHiddenCols] = useState(["city", "price"]);
  useEffect(() => {
    fetch("https://assets.antv.antgroup.com/s2/basic-table-mode.json").then(
      (res) =>
        res.json().then((res) => {
          setData(res);
        })
    );
  }, []);

  const s2DataConfig = useMemo(() => {
    return {
      fields: {
        columns: ["province", "city", "type", "price", "cost"],
      },
      meta: [
        {
          field: "province",
          name: "省份",
        },
        {
          field: "city",
          name: "城市",
        },
        {
          field: "type",
          name: "商品类别",
        },
        {
          field: "price",
          name: "价格",
        },
        {
          field: "cost",
          name: "成本",
        },
      ],
      data: data,
    };
  }, [data]);

  const s2Options = useMemo(() => {
    return {
      width: 600,
      height: 480,
      interaction: {
        hiddenColumnFields: hiddenColumnFields,
      },
    };
  }, [hiddenColumnFields]);

  console.log(s2Options);

  return (
    <div>
      <button
        onClick={() => {
          setHiddenCols(["city"]);
        }}
      >
        change to sub
      </button>
      <button
        onClick={() => {
          setHiddenCols(["type"]);
        }}
      >
        change to other fields
      </button>
      <SheetComponent
        dataCfg={s2DataConfig}
        options={s2Options}
        sheetType="table"
      />
    </div>
  );
};

🔗 Reproduce Link

复现链接

🤔 Steps to Reproduce

初始隐藏 ["city", "price"]两个字段,点击 change to sub 按钮,此时UI没有变化
点击change to other fields改变hiddenColumnFields 为['type'],此时 cityprice依然不可见

😊 Expected Behavior

预期根据最新指示的hiddenColumnFields控制隐藏列展示UI

😅 Current Behavior

取了几次指定options指定的hiddenColumnFields的交集

💻 System information

Environment Info
System macOS14.1.2
Browser 120.0.6099.129(正式版本) (arm64)
@lijinke666 lijinke666 added the 🐛 bug 这个是一个 bug label Jan 12, 2024
Copy link
Contributor

你好 @QJerryxjh,很抱歉给你带来了不好的体验, 我们会尽快排查问题并修复, 请关注后续发布日志.

Hello, @QJerryxjh, We are so sorry for the bad experience. We will troubleshoot and fix the problem as soon as possible. Please pay attention to the follow-up change logs.

@lijinke666
Copy link
Member

ref #2507

lijinke666 added a commit that referenced this issue Jan 23, 2024
* fix(interaction): 修复隐藏列头配置更新时未覆盖上一次的配置 close #2495

* test: 更新单测描述

* fix: 提取函数

* docs: 更新隐藏列头相关 demo
lijinke666 added a commit that referenced this issue Jan 24, 2024
* fix(interaction): 修复隐藏列头配置更新时未覆盖上一次的配置 close #2495

* test: 更新单测描述

* fix: 提取函数

* docs: 更新隐藏列头相关 demo
@lijinke666
Copy link
Member

🎉 This issue has been resolved in version @antv/s2-v1.54.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

@lijinke666
Copy link
Member

🎉 This issue has been resolved in version @antv/s2-react-v1.46.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@lijinke666
Copy link
Member

🎉 This issue has been resolved in version @antv/s2-vue-v1.6.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@lijinke666
Copy link
Member

🎉 This issue has been resolved in version @antv/s2-v2.0.0-next.11 🎉

The release is available on:

Your semantic-release bot 📦🚀

@lijinke666
Copy link
Member

🎉 This issue has been resolved in version @antv/s2-vue-v2.0.0-next.10 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging a pull request may close this issue.

2 participants