reactjs - React Ag Grid 与材质主题类
问题描述
有什么方法可以将基于材质主题的类实现到 Ag Grid 行。下面是我的场景。提前致谢
材质样式
const styles = makeStyles((theme) => ({
actionIcon: {
'& svg': {
fontSize: theme.palette.currentTheme.gridIconSize,
color: theme.palette.currentTheme.gridIconColor,
opacity: 0.6,
}
},
rowNormal: {
backgroundColor: theme.palette.currentTheme.gridValueBackgroundColor,
color: theme.palette.currentTheme.gridValueFontColor,
},
rowHeader: {
backgroundColor: theme.palette.currentTheme.gridHeaderBackgroundColor,
color: theme.palette.currentTheme.gridHeaderFontColor,
}
}));
行样式函数
this.state = {
getRowStyle: (params) => {
const {classes}= this.props;
if (params.node.group) {
return (classes.rowNormal)
} else {
return (classes.rowHeader)
}
},
};
AG网格
<AgGridReact
modules={this.state.modules}
columnDefs={this.state.columnDefs}
defaultColDef={this.state.defaultColDef}
debug={true}
rowData={this.state.rowData}
onGridReady={this.onGridReady}
frameworkComponents={this.state.frameworkComponents}
getRowStyle={this.state.getRowStyle}
/>
解决方案
推荐阅读
- r - 我如何计算这个数据框?
- android - 如何在 Android 中使用 Paging 3 库观察 Room 中更改的项目
- python - Python Unittest模拟问题
- c# - How to update every row using this function in database by getting the id of every row?
- python - 合并两个不同维度的数据框
- reactjs - 当组件需要一个对象时,如何将函数作为道具传递?
- ruby-on-rails - Postgres 将选定的 json_agg'regated 字符串视为一个数组
- jenkins - Jenkins - 选择要提取的分支和多个文件
- c# - 模型内部的变量在访问时不显示正确的值
- python - Pandas:将具有字典列表的列表附加到现有数据框