Comments (8)
这个没问题,我在 sort 的 options 中透出两个新的字段吧,允许上层配置激活和未激活的颜色
from ali-react-table.
from ali-react-table.
commonTransforms.sort(options: SortOptions):表格排序
该 transform 会同时对 dataSource 和 columns 进行更新
该 transform 会根据 options.sorts 来排序 dataSource
options.mode=multiple (默认值)时支持多字段排序(先按字段 1 排序,然后按字段 2 排序,依次类推)
options.mode=single 时表现为单字段排序
无论是多字段还是单字段排序,options.sorts 始终为一个数组
该 transform 支持树状结构数据的排序,即同一个节点下的子节点才会进行相互比较
注意排序字段对应的列必须有 column.features.sortable = true 的配置,否则将会忽略该字段的排序
features.sortable = true 时默认为自然序(对于数字)或字典序(对于字符串)
我们可以通过给 features.sortable 传递一个函数来自定义比较规则,该函数将被作为 Array#sort 的参数
options.orders 可以用来指定排序切换顺序
默认值为 ['desc', 'asc', 'none'],即连续点击某一列的表头时,先按降序排序,然后按升序排序,最后取消排序
如果要传入自定义的 orders,需要满足以下规则:
none 不能作为 orders 的第一个元素
none 必须在 orders 中
SortOptions 类型见下方
type SortOptions = {
sorts: Array<{ code: string; order: 'asc' | 'desc' }>
onChangeSorts(nextSorts: Array<{ code: string; order: 'asc' | 'desc' }>): void
orders?: Array<'asc' | 'desc' | 'none'>
mode?: 'single' | 'multiple'
}
from ali-react-table.
@LitterPig 抱歉,我的说法有点问题。 目前还不支持,我的意思是等下一个小版本我会加上
from ali-react-table.
希望可以尽快实现呀~那我可以自定义sort的图标吗?因为现在是svg的吗,我想自己传i标签进去,这个目前支持吗
from ali-react-table.
那我可以自定义sort的图标吗?因为现在是svg的吗,我想自己传i标签进去,这个目前支持吗
@LitterPig 现在还不支持。
我想了想大概有两个方案…
- 第一个是我给 sort 开放一些选项或者回调,让上层来控制 sort 表头的一部分渲染
- 第二个是我开放一下 sort 内部用到的数据处理方法,上层根据这些方法就能实现完全自定义的排序功能了
当然这两个方案也不冲突,我先添加一些选项或者回调吧
from ali-react-table.
嗯啊,可以方便加个聊系方式吗~
from ali-react-table.
@LitterPig 功能已经在 0.12.2 中实现了,过会儿我去发个版本,有问题的话继续在这里说
from ali-react-table.
Related Issues (20)
- 重复更新dataSourse数据,更新次数越多页面越卡顿,尤其是数据量较大的情况
- React 18 下滚动会出现很明显的白屏 HOT 2
- react18版本开始不支持,导致npm install抛错
- 多选自定义不生效
- buildTree之后checkStrictly失效,选择父亲儿子不会自动选中
- 打包后数据只显示一行,本地运行显示正常
- 虚拟滚动下表格向右滑动行高度会发生变化
- 超过10000 列怎么异步加载
- 问下,怎么固定第一行数据? HOT 2
- 官方文档中的BaseTable/基本用法跳转BaseTable API链接报错
- 父级元素设置了overflow:hidden,虚拟滚动会失效,这应该怎么处理?
- 拖拽调整列宽之后如何能够知道是哪一列的长度发生变化
- 行分组只支持一级分组吗?可以支持多级分组吗?
- 开启虚拟滚动,又想要全局搜索,有什么好的方案吗 HOT 3
- npm install --force or --legacy-peer-deps HOT 2
- 滚动条,X轴内容可滚动,但是滚动条滚动,内容不同步滚动 HOT 1
- react现在版本是18,但库里是16,17,安装提示依赖错误
- 请问这个还维护嘛 HOT 1
- components.EmptyContent里的按钮无法点击问题 HOT 1
- 当表格出现横向和纵向滚动条之后会出现错位
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ali-react-table.