Hi,
Can i add a tab to a tabset dynamically, and embed a page in this new tab?
For ex, when a user need to add a new city in address form, i prefer the user to stay in address form and add city in another tab.
Regards…
Hi @Alpay_Alkan,
Adding tabs dynamically isn’t natively supported by UI Bakery. I tested if it can be achieved with some hacks, but that didn’t work either.
But, using your example, if you want the user to be able to add cities, is there a reason not to already have that tab instead of adding it dynamically?
Thank you for the answer.
For such foreign keys, lots of same tabs will be added to different pages, if it will not be dynamic.
Mhm, I’m not sure if I genuinely understand what your limitations and desired results are.
Something that maybe could work for you though, is making a module with a tabset that already has all the tabs you need. Then you can pass the tabs that you want to be visible and somewhat like that have the dynamic tabs.
For example:
Create new module:
Add a tabset component. I also added some simple text for showcase reasons:
Create a State variable (in the module):
Create an action that sets the value of the state:
Set a On app data
trigger that executes the action
For each tab, set the Visibility
option to check if the state includes a certain identifier. You can, of course, choose any identifier that you want. I’m just going to use the title of the tab:
Once set for all tabs, the tabset will look pretty empty. While developing, you can always just set the initial value of the state so it contains all tabs (but don’t forget to set it to []
when deploying):
Before we use the module, I recommend checking this option on the body of the module
This makes it easier to resize and position the module.
Now, you can add the module to any page.
And if you pass the identifiers of the tabs you want to be visible in the Data
option of the module, only those tabs should be visible:
Thank for your for detailed answer.
For example, “project” table is referenced by 15 different tables, and user may require to insert/update project from all of the related 15 forms. And some tables might contain lots of foreign keys. Module usage would require lots of common pages in different modules.
Minimized/singular pages is very important, i am wrong?
Does it really need multiple modules? If you have all the forms, each in a different tab, and they all have the insert/update queries defined, doesn’t that work?
I apologize for asking around so much, it’s just not very clear to me what the issue with the foreign keys and multiple tables is.