jQWidgets Forums
jQuery UI Widgets › Forums › Navigation › Tabs › Recognise dinamycally created tab and destroy widgets inside at closing moment
This topic contains 5 replies, has 2 voices, and was last updated by Dimitar 10 years, 5 months ago.
-
Author
-
October 30, 2014 at 7:27 pm Recognise dinamycally created tab and destroy widgets inside at closing moment #61893
Hi,
Two problems with tabs .
1-st – don’t found how to recognize exist alreday created tab or not . I found discus about that : http://www.jqwidgets.com/community/topic/find-tab-position-based-on-id/ . But maybe are some news about that ?I’m using dinamyc menu and tabs are created after pressing on menu on main – 0 based – tab . At this moment I’m seeing that i can play with array – creating tab to put ID in array and index too, after returning to main tab and then pressing on menu item I can check this array and find it’s alreday created or not . Closing tab I can index to do 0 – that will mean , that tab closed and destroyed …
2-nd – how to recognize inside new created tab widgets programatically ? I want after closing of tab event destroy widgets inside. Exist such possibility ?
Problem is that from main menu source is creating tab and load related html file inside new tab . Now after user click on tab close button , source must to recognise widgets and destroy them …
Thanks in advance !
October 30, 2014 at 7:41 pm Recognise dinamycally created tab and destroy widgets inside at closing moment #618941- st question solved – found that : http://www.jqwidgets.com/community/topic/how-to-find-a-tab-based-in-the-tab-title/ . It works fine .
It leave 2-nd question .
I really don’t konw – it must be destroyed widgets closing tab or not ? Maybe this alreday is doing closing event of tab ?
October 31, 2014 at 5:58 am Recognise dinamycally created tab and destroy widgets inside at closing moment #61909Hello usrimas,
jqxTabs does not “know” what widgets you have in its contents. This means you would have to destroy each widget manually after closing the tab.
Best Regards,
DimitarjQWidgets team
http://www.jqwidgets.com/October 31, 2014 at 6:02 am Recognise dinamycally created tab and destroy widgets inside at closing moment #61910Hello Dimitar,
thanks for the answer . I have an idea to add for div elements class . Something like that – grid element will have class=’grid’. Then closing tab I can search class elements and then try recognise div elements and then try to destroy … I’ll try that …
October 31, 2014 at 6:43 am Recognise dinamycally created tab and destroy widgets inside at closing moment #61915Problem … how to get conetnt of tab in ‘remove’ event ?
remove event :$( '#mTab' ).on( 'removed', function( event ){ clear_tab( event ) });
function :
function clear_tab( event ) { var args = event.args; var cont = $( '#mTab' ).jqxTabs( 'getContentAt', args.item ); debugger; }
Content var ‘cont’ is null . No content …
Maybe I’m doing not in this way ?November 3, 2014 at 6:38 am Recognise dinamycally created tab and destroy widgets inside at closing moment #62026Hello usrimas,
Please check out the following forum post with a user-defined “beforeRemove” event: http://www.jqwidgets.com/community/topic/prevent-tab-close/#post-55111. You can use it instead of the default removed event and the content of the tab should still be available in its handler. Note, however, that “beforeRemove” is not supported and we do not guarantee some unexpected behaviour would not ensue.
Best Regards,
DimitarjQWidgets team
http://www.jqwidgets.com/ -
AuthorPosts
You must be logged in to reply to this topic.