I am working on customizing the DocType form in ERPNext and would like to dynamically add nested subtabs (a tab within another tab) using a custom button. I managed to add regular tabs, but I’m struggling to add nested subtabs that display correctly.
Here’s a simplified version of what I have tried (doctype.js):
Thanks for your reply! But my problem is not that I can’t create a tab break, but that I can’t create a tab break inside a tab break (nested tab break). The goal is to add a button to create a nested tab. Most likely I need to create a new field type with a sub tab type, which I need help with.
Any help or guidance would be greatly appreciated.
Thanks for your reply! This method does add a sub-tab, but it is not possible to switch between such tabs, and it is also not entirely clear how to hide and show the fields between these tabs. Also, this method is not very user friendly
You will have to implement these features yourself. I think you already have a big part of the solution (judging by the screenshot). But you do need to add a little bit of code to make it work yes.
Sadly, without more details on the contents of these sub-tabs, we can’t help you more:
Will they contain fields in the doctype? In this case, why bother with subtabs? (you can try having tabs like “Group/Subtab 1”, “Group/Subtab 2”, …)
Will they be generated on-demand? (Will the number of tabs vary between documents?)
It might also be interesting to think more about the data model: could your subtabs become documents or child documents?
Creating tabs with the names “Group/Subtab 1” will not work, because in my case there will be a lot of regular tabs (about 20)
Yes, different documents can have a different number of subtabs, just as each tab can have a different number of subtabs.
These subtabs are needed to place different content (fields) in them, and the functionality of the subtabs will be used very often, so I’m not sure how convenient it will be to add an html field each time
It might also be interesting to think more about the data model: could your subtabs become documents or child documents?
Most likely not, because as I said earlier - there are too many sub-tabs. Thats why i want to add new field type “Sub Tab-Break”