Add tabs dynamically in tabs-panel

Hi,

On my freedom UI page I want to dynamically add tabs in tab panel, with each tab click should open same iframe with diff parameters.

I want to know if this is possible and if so how we can accomplish this. If not possible, do we have a work around for this?

Can any one guide me on how to do this?

Thanks in advance for your support!!

Like 0

Like

3 comments

Hello,

The functionality that you might be looking for is Business Rules. They allow hiding or displaying tabs depending on the changes made on the page. 

The details can be found in this article: 

https://academy.creatio.com/docs/8.x/no-code-customization/customization-tools/ui-and-business-logic-customization/freedom-ui-business-rules

 

Otherwise, if this is not something you are trying to achieve, please provide a detailed example of your desired logic. 

 

Thank you and have a nice day! 

Hello @Hanna Skalko,

Thank you for the response !!

I am working with an API that returns a set of URLs. The number of URLs may vary depending on the parameters passed to the API.

I would like to display each URL inside an individual iFrame, with each iFrame placed within its own tab. Since the number of URLs is dynamic, I need a way to create tabs dynamically within a tab panel, one for each URL returned.

Is it possible to add tabs dynamically to the tab panel based on the API response?

Hi Madhav Patel,

In general, the tab panel cannot have dynamic tabs. This is due to the peculiarity of dynamic display generation, its reuse between pages, and is done to improve performance.

As a workaround, you can use the previously suggested solution or use the crt.TemplateList component on the page to create a collection attribute and populate it with the required number of tabs. You can read more about this here:

https://academy.creatio.com/docs/8.x/dev/development-on-creatio-platform/platform-customization/freedom-ui/render-repeated-ui-components

https://academy.creatio.com/docs/8.x/dev/development-on-creatio-platform/platform-customization/freedom-ui/page-customization-basics/references/templatelist

Overall the idea is as follows: use the crt.TemplateList component on the page, create an attribute as a collection, and populate it according to the number of required tabs. Then add a button toggle group, and through the button group events you control which elements are displayed. When the page is opened, all of them will have visible = false. When a button is selected, immediately find the corresponding record in the collection and change its visibility. This will allow dynamically render a list of content, but all items must be of the same type. In other words, there’s only one template, but many records in the collection.

Show all comments