formio.js
formio.js copied to clipboard
[BUG] Tab component dosent work after nested with dataGrid
Environment
Formio sandbox Please provide as many details as you can:
- Hosting type
- [x] Form.io
Steps to Reproduce
- Drag and drop tab component
- Drag and drop DataGrid also drags and drops the tab component inside the Datagrid
- 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
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
Closing this thread as it is outdated. Please re-open if it is still relevant. Thank you for your contribution!