Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7882583
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T04:19:13+00:00 2026-06-03T04:19:13+00:00

I am trying to toggle from a Tab Container view to Title Pane view.

  • 0

I am trying to toggle from a Tab Container view to Title Pane view. I am pulling in all dom objects with a class of “cPane”. Initially I am assigning as dijit.layout.ContentPane, when I hit the toggle button I am trying to re-assign to dijit.TitlePane.

It seems the dom element are not keeping its attributes. I have tried every “destroy” method, but when I assign them to TitlePane they are blank. How can I re-assign dom nodes without losing attributes? Thanks.

Here is my code: http://jsfiddle.net/afarris/gFXnH/11/

dojo.require("dojo.parser");
dojo.require("dijit.form.Button");
dojo.require("dijit.layout.TabContainer");
dojo.require("dijit.layout.ContentPane");
dojo.require("dijit.TitlePane");

dojo.addOnLoad(function() {

dojo.parser.parse("widget");

var cc = dojo.byId("contentContainer");

dojo.query(".cPane").forEach(function(n){
   new dijit.layout.ContentPane({
        title: dojo.attr(n, "title")
    }, n);
});

var dtc = new dijit.layout.TabContainer({
   style: "height:100px; width: 100%;"
}, cc);

dtc.startup();    

var tabMode = true;


new dijit.form.ToggleButton({
    showLabel: true,
    checked: false,
    onChange: function(val) {
        if (tabMode == true) {
            dtc.destroyDescendants(true);
            dojo.query(".cPane").forEach(function(n){
            console.log('found contentPane');
                new dijit.TitlePane({
                    title: dojo.attr(n, "title"), open: "true"
                }, n), cc;
            });            
        }

    },
    label: "toggle"
},
"viewToggle");    

});

<div class="tundra">
<div id="widget">
<button id="viewToggle"></button>
<div id="contentContainer">
    <div class="cPane" title="First" style="width: 100%; height: 100px">test</div>
    <div class="cPane" title="Second" style="width: 100%; height: 100px"><p>demo</p></div>
 </div>
</div>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T04:19:15+00:00Added an answer on June 3, 2026 at 4:19 am

    When you call .destroyDescendants, you’re destroying the tab container, which destroys the content panes, which destroys your original .cPane divs. So they’re not there to put in as TitlePanes.

    When you construct your initial ContentPane, you’re making your .cPane nodes into your ContentPanes (not inside your ContentPanes), so they’ll go away when you destroy the tab container.

    So, you need to get your content out of your content panes before you destroy them. This’ll probably be less confusing to do if you put your content into your content panes instead of turning your content into content panes. (And the same when you create the TitlePanes.) Then you can just use ‘place’ to move your content from ContentPane to TitlePane (e.g. http://dojotoolkit.org/documentation/tutorials/1.7/dom_functions/)

    I’m not quite sure what you’re trying to achieve, so it’s a bit tricky to answer.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Trying to make a toggle button that hides/shows the right window/pane. Here is a
I am trying to write a method that will toggle a button from being
I am trying to fill my view model with some drop down options from
I'm trying to set up a simple script to toggle a link from a
I'm trying to bring an ID from DOM back with a .replaceWith, even though
I'm trying to generate this html <a href=# class=button onclick= $('#someControl').toggle('blind', { easing: 'easeInOutSine'});
I'm trying to stop a toggle button from changing state when clicked, based on
I'm trying to add a split view inside of a tab bar, and since
I'm trying to toggle a UI Button from a callback of a POST operation.
I'm trying to target ol.sc-tracklist from within the following markup <ul id=sc-track-list> <li class=sc-track

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.