formio.js icon indicating copy to clipboard operation
formio.js copied to clipboard

[BUG] Tab component dosent work after nested with dataGrid

Open darshancreed opened this issue 4 years ago • 1 comments

Environment

Formio sandbox Please provide as many details as you can:

  • Hosting type
    • [x] Form.io

Steps to Reproduce

  1. Drag and drop tab component
  2. Drag and drop DataGrid also drags and drops the tab component inside the Datagrid
  3. after this you cant drag and drop anything you will get the error as seen in the image

Expected behavior

you can add more components after this

Observed behavior

Tab component is throwing error and will not accept any more component In src/components/tabs/Tabs.js this file attach method has this.refs[this.tabKey].forEach((tab, index) => { this.attachComponents(tab, this.tabs[index], this.component.components[index].components || []); });

The error is coming from this part of the code Also it is because if you have the same id for both tab component

Example

Screenshot 2022-10-04 at 12 53 06 PM

For code or form JSON, please enclose in a code block:

{
    "display": "form",
    "settings": {
        "pdf": {
            "id": "1ec0f8ee-6685-5d98-a847-26f67b67d6f0",
            "src": "https://files.form.io/pdf/5692b91fd1028f01000407e3/file/1ec0f8ee-6685-5d98-a847-26f67b67d6f0"
        }
    },
    "components": [
        {
            "label": "Tabs",
            "components": [
                {
                    "label": "Tab 1",
                    "key": "tab1",
                    "components": [
                        {
                            "label": "Data Grid",
                            "reorder": false,
                            "addAnotherPosition": "bottom",
                            "layoutFixed": false,
                            "enableRowGroups": false,
                            "initEmpty": false,
                            "tableView": false,
                            "defaultValue": [
                                {}
                            ],
                            "key": "dataGrid",
                            "type": "datagrid",
                            "input": true,
                            "components": [
                                {
                                    "label": "Tabs",
                                    "components": [
                                        {
                                            "label": "Tab 1",
                                            "key": "tab1",
                                            "components": []
                                        },
                                        {
                                            "label": "tab3",
                                            "key": "tab3",
                                            "components": []
                                        }
                                    ],
                                    "key": "tabs",
                                    "type": "tabs",
                                    "input": false,
                                    "tableView": false
                                }
                            ]
                        }
                    ]
                },
                {
                    "label": "tab2",
                    "key": "tab2",
                    "components": []
                }
            ],
            "key": "tabs",
            "type": "tabs",
            "input": false,
            "tableView": false
        },
        {
            "type": "button",
            "label": "Submit",
            "key": "submit",
            "disableOnInvalid": true,
            "input": true,
            "tableView": false
        }
    ]
}
// your code here

darshancreed avatar Oct 04 '22 07:10 darshancreed

Closing this thread as it is outdated. Please re-open if it is still relevant. Thank you for your contribution!

daneformio avatar Feb 07 '24 14:02 daneformio