ag-grid:需要将多个字段聚合到单元格中的表中 [英] ag-grid: Need to aggregate multiple fields into a table within a cell

查看:1150
本文介绍了ag-grid:需要将多个字段聚合到单元格中的表中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道在 ag-grid <单元格中显示表格(包含来自多个字段的数据)的最佳实践是什么? / code>?

I'm wondering what the best practice is for displaying a table (with data from multiple fields) within a cell in ag-grid?

我想我可以将整个表格格式化为html字符串并将其作为<$ c传递给网格$ c> field 并使用 cellRenderer ,但是我宁愿在服务器端不使用这种视图逻辑。

I think I can get it to work with formatting the entire table as an html string and passing that to the grid as the field and using a cellRenderer, however I'd rather not have that kind of view logic on the server-side.

我真的希望列定义能够接受多个字段,但似乎不可能。

I'd really like for the column definition to be able to take in more than one field, but it doesn't seem like that's possible.

有什么想法吗?谢谢。

推荐答案

您可以在所需的列中定义 valueGetter 列定义
这是一个示例-

You can define a valueGetter for the desired column in column def. Here is a sample -

valueGetter: 
function sumField(params) {
          return params.data.a + params.data.b
}

价值获取者示例

这篇关于ag-grid:需要将多个字段聚合到单元格中的表中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆