Ag grid Ag网格服务器端行组密钥创建者
当使用Ag Grid的服务器端行模型时,我无法向服务器发送自定义组密钥以执行正确的分组查询 我的行数据是一个简单的JSON结构,但只有一个复合对象Ag grid Ag网格服务器端行组密钥创建者,ag-grid,ag-grid-react,ag-grid-grouping,Ag Grid,Ag Grid React,Ag Grid Grouping,当使用Ag Grid的服务器端行模型时,我无法向服务器发送自定义组密钥以执行正确的分组查询 我的行数据是一个简单的JSON结构,但只有一个复合对象 row = { athlete: '', age: '', country: { name: 'Ireland', code: 'IRE' }, ... } 我使用的是服务器端行模型。要让网格显示国家名称非常简单,因为我使用以下列定义 { headerName: "Countr
row = {
athlete: '',
age: '',
country: {
name: 'Ireland',
code: 'IRE'
},
...
}
我使用的是服务器端行模型。要让网格显示国家名称非常简单,因为我使用以下列定义
{
headerName: "Country",
colId: "country",
valueGetter: "data.country.name",
enableRowGroup: true
}
但是,当我按Country column进行分组时,ag grid将上面示例中的groupKey发送为“Ireland”。但我需要组密钥是国家代码“IRE”。我不知道在使用服务器端行模型时如何生成groupKey
我见过keyCreator方法,但这只适用于客户端行模型。此外,我还看到了树数据模式,该模式对getServerSideGroupKey(dataItem)
进行回调,但回调仅在gridOptions.treeData=true
时使用,并且当treeData选项设置为true时,无论分组是否发生,始终显示“Group”列。我通过设置isServerSideGroup:function(dataItem){returnfalse;}
任何帮助都将不胜感激 通过使用列定义的字段属性的点表示法和自定义cellRenderer,我能够解决这个问题
{
headerName: "Country",
colId: "country",
field: "country.code",
enableRowGroup: true,
cellRenderer: function (params) {
return params.data.country.name;
}
}
这使我能够显示来自自定义对象的正确数据点,并且在执行服务器端操作时,ag grid将发送字段属性中包含的数据点。我能够通过使用列定义的字段属性的点表示法和自定义cellRenderer来解决此问题
{
headerName: "Country",
colId: "country",
field: "country.code",
enableRowGroup: true,
cellRenderer: function (params) {
return params.data.country.name;
}
}
这使我能够显示来自自定义对象的正确数据点,并且在执行服务器端操作时,ag grid将发送字段属性中包含的数据点