Ernani Joppert
Ernani Joppert

Reputation: 528

Generating Dynamic Views in Admin on Rest

For both Edit, List and Show, I have dynamic dates that may or may not have values attached to them, I've been willing to render dynamic Custom TextFields, essentially tags but can't seem to get it to work.

Data structure is somehow similar to this:

{
  "id": 1,
  "category_type": "One",
  "category_name": "Type One",
  "prices": [
    {
      "value": 123.00
    },
    {
      "value": 123.00
    },
    {
      "value": 123.00
    }
  ]
},
{
  "id": 2,
  "category_type": "Two",
  "category_name": "Type Two",
  "prices": [
    {
      "value": 123.00
    }
  ]
}

Prices are coming based on a calendar timeframe, index 0 is start date, and end date determines the end of the date. Some dates will have 0 values, others will have value > 0.

The idea here is to produce a great datagrid with dynamic TextFields or TextInputs so Users can view/add/edit prices or zero it based on a start/end date period.

Edit: I've tried to outline the explanation in a mockup:

Mockup info of data structure in an hypothetical EDIT page

Upvotes: 0

Views: 367

Answers (1)

kunal pareek
kunal pareek

Reputation: 1283

1) You need to create a custom form. This can be of help to you. See my answer at the bottom of page about creating and using custom Redux Form with AOR.

How to richly style AOR Edit page

2) You will have to create a custom datagrid using material UI table component within this form

3) Edit pages in AOR usually only edit 1 record of your resource. Above it seems you aim to edit multiple record simultaneously. I cannot clearly see a way to achieve that (though it should be possible)

4) AOR List component does not accept Input components because it is not a Redux Form connected component. But your connected DataGrid component that you create for the Edit Page should work as a child of AOR List component allowing you to edit multiple values.

Upvotes: 1

Related Questions