Tabview tab lost content when change tab

JAPJAP
edited September 11 in Technical questions

Hi,

In a tabview, every time I change the tab the content of the tabs that are not displayed disappears and I need to have access to the content of the hidden tabs since they are constantly loaded with data via ajax.

for example, if I have two tabs and in each of them I have a "ul" element and I load data from ajax like "li" to the "ul" element using jquery append, the ul element of the tab that is not visible is undefined

Please see snipet https://snippet.webix.com/wusw6v7g

Is there any way that the content of tabs is not lost?

Thanks in advance

Tagged:

Comments

  • edited September 12

    Hey @JAP,

    To answer your question, it is impossible to keep the DOM elements located in the other tab, since they only get rendered when you switch to the appropriate tab, also, when you switch between the tabs they get completely rerendered depending on the currently selected tab (meaning the DOM element gets added/deleted dynamically).

    However, while you can't do that specifically, there are a few possible options that would achieve a similar result:

    1. You can either explicitly redefine the existing template via the setHTML method: https://snippet.webix.com/1iq90lmt.

    2. Alternatively you can create a custom template function, which would take your data as an input and output the HTML node using that data: https://snippet.webix.com/uwknl683.

  • @Dzmitry, Perfect Thanks so much!!!

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!