不用 React 组件如何实现点击列头排序? #1280
-
翻遍了官网上的示例,只有用了 React 组件的例子才有列头上的下拉菜单可以执行排序等操作,因为对 React 不熟所以翻源码找不出具体的实现部分,请教是否有用原生类实现此类需求的例子以供参考?不胜感激! |
Beta Was this translation helpful? Give feedback.
Answered by
lijinke666
Apr 21, 2022
Replies: 1 comment 1 reply
-
原生类提供了
https://s2.antv.vision/zh/docs/manual/basic/tooltip#%E8%87%AA%E5%AE%9A%E4%B9%89 https://s2.antv.vision/zh/examples/react-component/tooltip#custom-tooltip
调用
export type SortMethod = 'ASC' | 'DESC' | 'asc' | 'desc';
|
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
lijinke666
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
原生类提供了
BaseTooltip
, 你可以继承它实现你自己的 下拉菜单, 然后点击调用s2
提供的排序方法即可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)
当前单元格信息: https://s2.antv.vision/zh/docs/manual/advanced/get-…