Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Removing a tab from a tab set destroys tab content

    GWT version: 2.5.0.
    SmartGWT version: 3.1-p20130226

    I would like to have a TabSet for which I can arbitrarily remove and add tabs.

    Here is what I do in the code:
    • add a tab with some content
    • remove the tab
    • add the tab back in


    If I do this any content in the tab that I removed appears to be lost/destroyed. I can no longer access that content without getting exceptions.

    (I have a sample program that demonstrates this but even though it’s a sample program it’s a little long. I will be happy to provide that code if needed.)

    Additionally I get this warning message on the developer console when I remove the tab.

    Code:
    15:26:05.546:MUP4:WARN:DynamicForm:isc_DynamicForm_0:Attempt to access destroyed widget in the DOM - destroy() called at invalid time (eg: mid-draw) or invalid method called on destroy()d widget. Stack Trace:
        [a]MathFunction.getStackTrace(_1=>undef, _2=>undef, _3=>undef, _4=>undef, _5=>undef)
        Canvas.getHandle()
        Canvas.$p9()
        Canvas.draw(_1=>undef, undef, undef, undef, undef, undef, undef, undef)
        [a]MathFunction.invokeSuper(_1=>[Class DynamicForm], _2=>"draw", _3=>undef, _4=>undef, _5=>undef, _6=>undef, _7=>undef, _8=>undef, _9=>undef, _10=>undef)
        DynamicForm.draw(_1=>undef, _2=>undef, _3=>undef, _4=>undef)
        Layout.addMembers(_1=>[DynamicForm ID:isc_DynamicForm_0], _2=>undef, _3=>undef)
        Layout.addMember(_1=>[DynamicForm ID:isc_DynamicForm_0], _2=>undef, _3=>undef)
        TabSet.createPane(_1=>[DynamicForm ID:isc_DynamicForm_0], _2=>Obj{ID:isc_Tab_1})
        TabSet.addTabs(_1=>Array[1], _2=>1)
        TabSet.addTab(_1=>Obj{ID:isc_Tab_1}, _2=>undef)
        anonymous(tabJS=>Obj{ID:isc_Tab_1})
        anonymous(thisObj=>IButton{ID: "isc_IButton_3",
    title: "add tab",
    position: "absolute",
    left: 345,
    redrawOnResize: false,
    styleName: null,
    parentElement: [HLayout ID:isc_HLayout_0],
    topElement: [VLayout ID:isc_VLayout_0],
    tabIndex: 1358,
    cacheOffsetCoords: true,
    zIndex: 200108,
    state: "Over",
    hasFocus: true,
    },
    
    . . . 
    
    (Much more similar stuff in the log)
    Some questions:
    • Is this the expected behavior?
    • Is there a recommended way to make tabs disappear and reappear without having to rebuild the tab and the content of the tab every time the tab is added back in?

    #2
    Set destroyPanes:false, or, use updateTab to set the pane to null before removing the tab.

    Comment


      #3
      Originally posted by Isomorphic View Post
      Set destroyPanes:false, or, use updateTab to set the pane to null before removing the tab.
      This worked like a charm. Thank you for your amazingly quick, accurate, and succinct response!

      Comment

      Working...
      X