I have a custom rendered column in my table. I want to get rowData on change of that switch

I got the solution. I can get the rowData in render itself.
@priyankakumari1011 can you show example that how resolved this problem?
I have the same problem and I am not getting it to work, when the page changes it does not update the component.
@alyssonmessias This is how I was doing that (this method was being called inside render)
setColumns = (roles) => {
this.columns = []
this.columns.push({ title: 'DeviceId', field: 'id' })
this.columns.push({ title: 'Device Type', field: 'deviceType' })
this.columns.push({ title: 'Platform Id', field: 'platformId', hidden: true})
this.columns.push({ title: 'Primary Owner', field: 'primaryOwner' })
this.columns.push({ title: 'IsFree', field: 'isFree', hidden: true, searchable: false, render: rowData => {
return (
{rowData.isFree.toString()}
)
} })
this.columns.push({
title: 'IsDedicated', field: 'isDedicated', filtering: false, searchable: false, render: rowData => {
return (
checked={rowData.isDedicated}
onChange={(event) => {
this.handleChange(event, rowData)
}}
value={rowData.isDedicated}
/>
)
}
})
this.columns.push({
title: 'IsFaulty', field: 'isFaulty', hidden: true, searchable: false, render: rowData => {
return (
{rowData.isFaulty.toString()}
)
}
})
}
Most helpful comment
@alyssonmessias This is how I was doing that (this method was being called inside render)
setColumns = (roles) => {
disabled={!roles.changeDedicated}
this.columns = []
this.columns.push({ title: 'DeviceId', field: 'id' })
this.columns.push({ title: 'Device Type', field: 'deviceType' })
this.columns.push({ title: 'Platform Id', field: 'platformId', hidden: true})
this.columns.push({ title: 'Primary Owner', field: 'primaryOwner' })
this.columns.push({ title: 'IsFree', field: 'isFree', hidden: true, searchable: false, render: rowData => {
return (
{rowData.isFree.toString()}
)
} })
this.columns.push({
title: 'IsDedicated', field: 'isDedicated', filtering: false, searchable: false, render: rowData => {
return (
checked={rowData.isDedicated}
onChange={(event) => {
this.handleChange(event, rowData)
}}
value={rowData.isDedicated}
/>
)
}
})
this.columns.push({
title: 'IsFaulty', field: 'isFaulty', hidden: true, searchable: false, render: rowData => {
return (
{rowData.isFaulty.toString()}
)
}
})
}