#10201 closed defect (invalid)
Programatically removing a tab in a tabcontainer does not work
Reported by: | vorun | Owned by: | |
---|---|---|---|
Priority: | high | Milestone: | tbd |
Component: | Dijit | Version: | 1.4.0b |
Keywords: | Cc: | ||
Blocked By: | Blocking: |
Description (last modified by )
The makeTab function is from the test_TabContainer.html page.
function makeTab() { var tc = dijit.byId("mainTabContainer"); var cp = new dijit.layout.ContentPane ({ title: 'Programmatically created tab ' + (progTabCounter++) , closable: true }); cp.domNode.innerHTML = "I was created programmatically!"; tc.addChild(cp, 0); }
I added this function to remove the current selectedChildWidget
function removeTab() { var tc = dijit.byId("mainTabContainer"); tc.removeChild(tc.selectedChildWidget); }
Change History (3)
comment:1 Changed 11 years ago by
Component: | General → Dijit |
---|---|
Description: | modified (diff) |
Owner: | anonymous deleted |
comment:2 Changed 11 years ago by
Resolution: | → invalid |
---|---|
Status: | new → closed |
comment:3 Changed 8 years ago by
I know this is 3 years in the past, but I was just having a similar problem (I think), and hopefully others who hit this page can benefit from this tidbit.
When you programmatically remove a child from the tab container, the child still exists in memory (if you do dijit.byId('tab-id'), you can see that it is still there).
For me, the error occurred when I tried to re-create the child that I had removed previously, since it still exists.
So instead of just removing it from the tab container, you have to both remove it and destroy the dijit object.
tc.removeChild(tc.getChildren()[0]); dijit.byId('tab-id').destroy();
Hope this helps.
You need to attach test cases to all your tickets using the "Attach File" button. Thanks.