FieldArray in a multi-step form with nested data

1 Answer 55 Views
Grid Stepper
Bernd
Top achievements
Rank 5
Bronze
Bronze
Iron
Bernd asked on 26 Nov 2021, 10:20 AM

I'd like to work with nested data in a multi-step form. The data structure looks like this:

[
    {
        "id": "5ca67a4b-cbcf-4851-8dcb-2bf5c8f5b5d5",
        "createDate": "1621287160000",
        "location": { "id": 12, "text": "City1" },
        "symbol": "shadow",
        "name": "Komfort",
        "active": true,
        "bcon": false,
        "user": "cdunkersley0@pcworld.com",
        "bas": "3DGIP0XJDNCJNRJKGS8XD6NHPBTNKTJ608S0UJ01X5P",
        "description": "aliquam augue quam sollicitudin vitae consectetuer eget rutrum at lorem integer tincidunt ante",
        "channelData": [
            {
                "channel": {
                    "id": "43e185d0-2f8c-4975-9e73-40412c03a1f1",
                    "name": "Lichtschalter"
                },
                "datapoint": {
                    "id": "f74ba945-b0e3-43f7-a17e-918623fd03b8",
                    "bas": "g60hm6owrhk4hcbtul6l2icuw1wlkeg",
                    "tag": "bdya|98e5lc|1wa8qv7u",
                    "type": "float",
                    "description": "id ornare imperdiet sapien urna pretium nisl ut volutpat"
                }
            },
            {
                "channel": {
                    "id": "9b369139-a0ef-404e-b7ec-2b9ca3f4471e",
                    "name": "Verdunkelungsregler"
                },
                "datapoint": {
                    "id": "b64b5e00-ccfc-489a-ac03-02f9491d8ad6",
                    "bas": "5zz7jkh4gyems6fppt9v5wqdqgoe92r",
                    "tag": "x3vj|ttqqz9|qo6pxmks",
                    "type": "float",
                    "description": "odio donec vitae nisi nam ultrices libero non mattis"
                }
            }
        ]
    },
...
]
What I'd like to do is to use the first step of the form for the general data and use a second step with a Grid for the data that is nested under the channelData node. I have setup the multi-step form using your documentation and the first step works fine but I'm not sure how this would work with the nested node in a grid on the second step as I don't know how to reference the data of the node in the name parameter of the FieldArray component. Do you have an example for something like this? Any help would be greatly appreciated.

1 Answer, 1 is accepted

Sort by
1
Accepted
Konstantin Dikov
Telerik team
answered on 30 Nov 2021, 06:11 AM

Hi Bernd,

For binding an FieldArray to a Grid you can refer to the following help topic and example:

As for your specific data, assuming that the Form is bound to a single object from the main array, you can set the "name" of the FieldArray directly to the "channelData" or use the approach shown in the above example, where you pass the data to the initialValues of the form to a specific name.

Here is the above example, simplified, but using your data structure:

For the editing, please refer to the first article.

 

Regards,
Konstantin Dikov
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
Grid Stepper
Asked by
Bernd
Top achievements
Rank 5
Bronze
Bronze
Iron
Answers by
Konstantin Dikov
Telerik team
Share this question
or