This is my React-component.
<AgGridReact
rowData={details}
columnDefs={columnDefs}
defaultColDef={defaultColDef}
autoGroupColumnDef={autoGroupColumnDef}
aggFuncs={aggFuncs}
groupIncludeFooter={groupIncludeFooter}
groupIncludeTotalFooter={groupIncludeTotalFooter}
></AgGridReact>
And this is my functionality.
const [columnDefs, setColumnDefs] = useState([
{
headerName: 'Details',
children: [
{
field: 'uniqId',
width: 90,
filter: 'agTextColumnFilter',
},
{
field: 'name',
width: 180,
filter: 'agNumberColumnFilter',
},
],
},
{
headerName: 'Other Details',
children: [
{ field: 'gender', width: 100 },
{
field: 'salary',
aggFunc: "sum",
width:100,
},
{
field: 'country',
width: 100,
filter: 'agNumberColumnFilter',
},
{
field: 'birthdate',
width: 100,
filter: 'agNumberColumnFilter',
},
{
field: 'vegetarian',
width: 100,
filter: 'agNumberColumnFilter',
},
{
field: "Edit",
colId: "view",
width: 100,
cellRendererFramework: function (params) {
return <button className="btn btn-secondary gridButton" onClick={() => getUserDetails(params.data._id)}> Edit </button>
}
},
{
field: "Delete",
colId: "view",
width: 100,
cellRendererFramework: function (params) {
return <button className="btn btn-danger gridButtonDelete" onClick={() => handleDelete(params.data._id)}> Delete </button>
}
},
],
},
]);
I need to show the sum of price column at the end of the table. I need to show in the bottom of the table. The sum need to reflect if someone add a new data the cells.
I am using ag-grid for my table. I need to show the sum of each column at the end of the table. After editing the cell, the sum value should be updated
Please help me on this.
Via Active questions tagged javascript - Stack Overflow https://ift.tt/qAxnIhr
Comments
Post a Comment