0

Hi and thanks in advance! Admin on Rest is a great base to start from to quickly build simple REST admins. I have a scenario where I would like to display and edit related records without leaving the parent. e.g Editing the Options of a Multiple Choice Question from the Question Edit View.

I have managed to implement a modal dialog that allows me to create/edit the Options(passed along as a record prop), however I'm stuck at trying to refresh the list of options on the Question View once I have successfully saved the Option.

I'm relatively new to React. Would appreciate a nudge in the right direction.

AnttyC
  • 116
  • 1
  • 8

1 Answers1

2

ReferenceManyField doesn't provide controls for filtering or pagination. However, it's quite straightforward to create some. Start by creating your own component using ReferenceManyField as a base. Store the page, sort, and filter as properties. Add methods that change these properties and re-trigger fetchReferences. Add buttons (pagination, filtering, etc) that trigger these methods.

But if you'r new to React, this won't be easy. I suggest you learn React first.

François Zaninotto
  • 7,068
  • 2
  • 35
  • 56
  • Thanks! by "using `ReferenceManyField` as a base" do you mean extending it like `class ReferenceManyFieldWithRefresh extends ReferenceManyField` then calling fetchReferences when needed? Are there any quick examples of extending Admin on Rest components I could take a look at? – AnttyC May 09 '17 at 14:53
  • Yes, you can extend, or create your own class by copying the code. – François Zaninotto May 11 '17 at 09:35