Skip to content

不用 React 组件如何实现点击列头排序? #1280

Closed Answered by lijinke666
nightire asked this question in Q&A
Discussion options

You must be logged in to vote

原生类提供了 BaseTooltip, 你可以继承它实现你自己的 下拉菜单, 然后点击调用 s2 提供的排序方法即可

  • Tooltip 参考:

可以自定义类, 也可以自定义 content

https://s2.antv.vision/zh/docs/manual/basic/tooltip#%E8%87%AA%E5%AE%9A%E4%B9%89

https://github.com/antvis/S2/blob/814d8aa5c6198c94944fc397825a4473e9cf2bd0/packages/s2-react/src/components/tooltip/custom-tooltip.tsx

https://github.com/antvis/S2/blob/814d8aa5c6198c94944fc397825a4473e9cf2bd0/packages/s2-react/src/common/constant/options.ts

https://s2.antv.vision/zh/examples/react-component/tooltip#custom-tooltip

  • 排序:

调用 s2.groupSortByMethod(sortMethod, meta)

  • sortMethod
export type SortMethod = 'ASC' | 'DESC' | 'asc' | 'desc';
  • meta

当前单元格信息: https://s2.antv.vision/zh/docs/manual/advanced/get-…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@nightire
Comment options

Answer selected by lijinke666
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants