In my React project, I need to customize antd table header as follows
我在下面添加了示例代码。
I need to have Sum of the amount in the header of the Amount column
示例代码:
https://codesandbox.io/embed/great-sun-534cd
您可以使用这样的标题函数来获取总金额字段
const columns = [
{
title: () => {
var total = 0;
for(var i=0;i<data.length;i++){
total += data[i].amount;
}
return <div>total {total}</div>;
} ,
dataIndex: "date",
width: 200
},
{
title: "Amount",
dataIndex: "amount",
width: 100
}
];
示例链接在这里https://codesandbox.io/s/festive-wiles-st6wl?fontsize=14
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)