Problem with closing tabbar


I’m creating dynamically closeable tabbar. First tabbar cell isn’t closeable and have menu . From menu I’m creating new tab :

         var tabn  = mTab.getNumberOfTabs() + 1;
         var newId = tabID + '_' + tabn.toString();
         var u     = findElement( $mPunk, "pnk_id", tabID );
         var html_cont  = $mPunk[ u ].html;
         var lab   = ( $app_lng == "lt" ? $mPunk[ u ].pav_lt : $mPunk[ u ].pav_en );
         mTab.addTab( newId, lab, null, null, true, true );
         if ( html_cont )
            mTab.tabs( newId ).attachURL( html_cont, true );
         mTab.tabs( newId ).setActive();

In the loaded html I’m rendering one object into tabbar cell :

$( mTab.tabs( tab_id ).cell ).w2render( myObj );

Now, clicking on tabbar close button I’m clearning rendered object and closing tab :

         mTab.attachEvent( "onTabClose", function( id )
            for ( var wdg in w2ui ) 
               var nm = w2ui[ wdg ].name;
               if ( nm.substr( 0, id.length ) == id )
                  $().w2destroy( nm );
            mTab.tabs( id ).close();
            return true;

On the “mTab.tabs( id ).close();” I’m getting error -
Uncaught TypeError: Cannot read property ‘childNodes’ of undefined
And tabs hangs up … :frowning:

What I’m doing bad ?

Could you provide the whole completed demo to test it?
These snippent are not enough to reproduce the issue … pport.html

Sorry, but I can’t to prepare a sample at this time - then I must in sample to do object render . This is a complex and a big obj …

I found a solution for the problem . Simply I did detection of rendered object and then destroy them in loaded html . It’s working . Though I want to it to do in moment of closing tabbar …

Please, try to close tab without object removing: closing dhtmlx tabs/windows must cleat its content