admin 管理员组文章数量: 1086019
I have this Material-UI DataGrid, how can I sum all of the values for the column Total Amount in which this will also be updated once filter is triggerd as well?
I am really unsure on how I can sum the entire column of total amount. Any help would be appreciated. Thank you
Codes:
const [filterModel, setFilterModel] = React.useState({
items: [
{
columnField: "totalAmount",
operatorValue: ">",
value: "200"
}
]
});
return (
<div style={{ height: 400, width: "100%" }}>
<DataGrid
// rows={rows}
columns={columns}
rows={data}
ponents={{
Toolbar: GridToolbar
}}
filterModel={filterModel}
onFilterModelChange={(newFilterModel) => setFilterModel(newFilterModel)}
/>
</div>
);
}
I have this Material-UI DataGrid, how can I sum all of the values for the column Total Amount in which this will also be updated once filter is triggerd as well?
I am really unsure on how I can sum the entire column of total amount. Any help would be appreciated. Thank you
Codes:
const [filterModel, setFilterModel] = React.useState({
items: [
{
columnField: "totalAmount",
operatorValue: ">",
value: "200"
}
]
});
return (
<div style={{ height: 400, width: "100%" }}>
<DataGrid
// rows={rows}
columns={columns}
rows={data}
ponents={{
Toolbar: GridToolbar
}}
filterModel={filterModel}
onFilterModelChange={(newFilterModel) => setFilterModel(newFilterModel)}
/>
</div>
);
}
Share
Improve this question
edited May 3, 2022 at 13:59
JS3
asked Mar 13, 2022 at 7:15
JS3JS3
1,8694 gold badges34 silver badges83 bronze badges
1 Answer
Reset to default 6You can create custom footer ponent, and then pass total
value as a prop.
Here I created sandbox with plete solution.
本文标签:
版权声明:本文标题:javascript - Material-UI DataGrid, display sum of column and sum updates according to filter as well - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://roclinux.cn/p/1744095398a2532805.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论