I've emitting a button in a column of a react bootstrap table2, which should be dynamically enabled/disabled programmatically:
{
dataField: 'dummy'
text: '',
formatter: (cellContent, row) => {
return ( <Button disabled={enableButton} onClick={() => handleDelete(row)}>Click!);
},
isDummyField: true
}
enableButton is set via a hook to true/false. When I reload the page the button is accordingly enbaled/disabled, so when table is rendered again everything is fine (also when sort the content or filter etc).
Do I need to force the rendering again (and how)? Or do I miss something. From my understanding the update should be triggered by the hook, so manual force to render is a bit ugly.
data
dynamically each time the state changes and the component re-renders, by calling map() on the original data and adding some row property based on the state. This way you can dodisabled={row.enableButton}
.