I have an edit form for a Post record, and I'm listing the Reviews associated with that Post in a ReferenceManyField/DataGrid (ie <ReferenceManyField target="post_id" reference="reviews">
). Each Review has the foreign key post_id
in the DB. This is all working fine, I have an edit and delete button for each Review row.
I need to add a 'Create Review' button for the Post form, such that the post_id
field in the Create Review form is pre-populated with the current id
of the Post. I'm not very expert in React/Redux.
As @Gildas has suggested above, you need a custom component for that.
1) A custom create button that routes to a create page for the review. For this you should look at how the React Router Link component documentation as well as how Admin On Rest would allocate a route for instance /:reviewId/create
2) Create a custom input component that will prefill the ID when loaded. This should be part of the location key in the props passed to your page. Ask additional questions as comments and I will try and answer them.
React and Redux are really simple things when you get the hang of them
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With