Comments (4)
@LitterPig 你看下是否可以通过 BaseTableProps#getRowProps
来实现类似的效果? 就是根据最近一次 treeOptions.onChangeOpenKeys 回调中的 action & key,设置一下相应的行的样式就好了。
function Component() {
const [openKeys, onChangeOpenKeys] = useState([]);
const [lastOpenKey, setLastOpenKey] = useState("");
const renderData = applyTransforms(
inputDataSourceAndColumns,
commonTransforms.treeMode({
primaryKey: "id",
openKeys,
onChangeOpenKeys(nextKeys, key, action) {
// 记录最近一次被展开的 key
if (action === "expand") {
setLastOpenKey(key);
} else {
setLastOpenKey("");
}
onChangeOpenKeys(nextKeys);
},
})
);
return (
<div>
<BaseTable
dataSource={renderData.dataSource}
columns={renderData.columns}
getRowProps={(row, rowIndex) => {
// 根据最近一次被展开的 key 来设置行的背景色
if (row.key === lastOpenKey) {
return { style: { background: "#ccc" } };
}
}}
/>
</div>
);
}
如果还是需要自定义箭头的颜色的话,我这边可以将相关的配置项开出来。
from ali-react-table.
你这个只能设置单元格的颜色吧,我其实想设置收拢和展示箭头的颜色
from ali-react-table.
@LitterPig 好的 这个等我周六加一下吧
from ali-react-table.
@LitterPig 已经实现好了
因为这个功能并非常见功能,需要在通过 CSS 类名来控制样式,可以参考这个示例
from ali-react-table.
Related Issues (20)
- 怎样可以实现滚动到指定行呢? HOT 2
- 如何实现动态添加列的功能? HOT 1
- 虚模式下表格从不可见到可见出现滚动条跳动问题
- 重复更新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,安装提示依赖错误
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.