Reputation: 3713
i am displaying table data inside modal dialog, when i click table row to edit data it will open another modal dialog, here i am getting row data by using clicked row id inside componentWillMount()
. but when i close edit modal dialog and try to edit other table row componentWillMount()
will not called. so edit modal dialog is empty. why componentWillMount
not calling every time?
Upvotes: 1
Views: 931
Reputation: 3713
I used following steps to fix it.
{(this.state.open) ? <Dialog open={true} ></Dialog> : null
componentWillUnmount() { }
Upvotes: 1
Reputation: 1640
As Nir H already mentioned, Dialog
component mounts into the dom only once, and then after you close it, becomes invisible (by changing the left position to -10000px) but still present inside the DOM.
So its clearly that componentWillMount
and componentDidMount
methods will be called only once. If you want to open Dialog
component with different options every time, you can do the folloving:
Dialog
component instanse in the parent component:ref={instance => {this.RowDialog = instance}}
handleOpen
method:onRowClick = (event) => {
this.RowDialog.handleOpen();
}
Upvotes: 1