react-bootstrap-table2
react-bootstrap-table2 copied to clipboard
How to Addition two datafield
Hello, I am new to React and cannot figure out how to addition multiple datafield value in this table.
I am trying to implement a datafield salary + additional_amount - deduction amount to pass in total amount column. const columns = [ { dataField: "s_no", text: "S.No", headerClasses: "data-sno", editable: false, formatter: (index, value, rowCount) => { return (rowCount + 1) }, }, { dataField: 'name', text: 'Name of employee', sort: true, formatter: nullChecker, editable: false }, { dataField: 'salary', text: 'Salary', headerClasses: "text-center", classes: 'text-center', sort: false, editable: false}, { dataField: 'additional_amount', text: 'Additional Amount', headerClasses: "text-center", classes: 'text-center', sort: false, validator: (newValue) => { if (isNaN(newValue)) { return { vaild: false, message: toast.error("Please enter numeric value") } } return true }, }, { dataField: 'deduction', text: 'Deduction', headerClasses: "text-center", classes: 'text-center', sort: false, validator: (newValue) => { if (isNaN(newValue)) { return { vaild: false, message: toast.error("Please enter numeric value") } } return true } }, {dataField: 'total_amount', text: 'Total Amount', headerClasses: "text-center", classes: 'text-center', sort: false, editable: false}, ];
<BootstrapTable
bordered={false}
classes="table table-head-custom table-vertical-center overflow-hidden"
bootstrap4
keyField="id"
columns={columns}
defaultSorted={defaultSorted}
cellEdit={cellEditFactory({
mode: "click",
blurToSave: true,
autoSelectText: true,
afterSaveCell: handleChange
})}
/>