ag-grid:需要将多个字段聚合到单元格中的表中 [英] ag-grid: Need to aggregate multiple fields into a table within a cell
问题描述
我想知道在 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屋!