I want to implement a AG grid table with a name, type columns. I want to add one more column "edit" in the table, and allow users to edit&delete the rows from the table. It will look like this:
I get my data from the redux store, this is the way I implement data inside rows.
const members = useSelector(state => state.members) // Get current members
const data = {
columnDefs : [
{headerName: 'Name', field: 'name'},
{headerName: 'Type', field: 'type'},
{headerName: 'Edit', field: 'edit'}
],
rowData: []
}
members.map((member) => {
data.rowData.push({
name:member.name,
type:member.type,
edit: '' // ?? What comes here so I can delete & edit by rows easily with buttons ??
})
})
return (
<div>
<div className="ag-theme-material">
<AgGridReact columnDefs={data.columnDefs} rowData={data.rowData} />
</div>
</div>
)
I am new to react-redux, what would be the best implementation? Is it even okay for me to get data inside the table with map function like above? Any suggestions would be appreciated.
