Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#7212 closed defect (worksforme)

Can't attach TabContainer or Tree programmatically to an expando in ightly build of 7/15/08 — at Version 1

Reported by: spidey2099 Owned by: Adam Peller
Priority: high Milestone: 1.2
Component: Dojox Version: 1.1.1
Keywords: Cc:
Blocked By: Blocking:

Description (last modified by dante)

A TabContainer?, AccordionContainer? or Tree can be attached programmatically to an ExpandoPane? in dojo-release-1.1. However, in the nightly build, this is no longer true. Here is the code:

var parent = document.getElementById ("container0");
var bc = new dijit.layout.BorderContainer ( {
    style : "width:500px; height:450px; border:2px solid black",
    id : "0"
} );
bc.startup();
dojo.byId (parent.id).appendChild (bc.domNode);

var div = document.createElement ("div");
dijit.byId (bc).domNode.appendChild (div);
var ep = new dojox.layout.ExpandoPane ( {
    title : "ep Test",
    region : "right",
    id : "1",
    style : "width:250px; height:275px;"
}, div);
ep.startup();
bc.addChild (ep);
constructTabContainer(ep, "2");

function constructTabContainer(parent, cid) {
    console.log ("Parent id: " + parent.id);
    var div = document.createElement ("div");
    dijit.byId(parent).domNode.appendChild (div);
    var tabContainer = new dijit.layout.TabContainer ( {
        tabPosition : "bottom",
        attachParent : "true",
        id : cid
    }, div);
    tabContainer.domNode.height = "400px";
    tabContainer.domNode.width = "275px";

    var cp1 = new dijit.layout.ContentPane ( {
        id : cid + ".1",
        title : "CP1"
    });
    cp1.domNode.style.height="400px";
    cp1.domNode.style.border="2px solid red";
    cp1.setContent("Content for CP1");
    tabContainer.addChild(cp1);

    var cp2 = new dijit.layout.ContentPane ({
        id : cid + ".2",
        title : "CP2"
    });
    cp2.domNode.style.height="400px";
    cp2.setContent("Content for CP2");
    tabContainer.addChild(cp2);

    tabContainer.startup();
}

Has something changed? Do we need to attach nodes to the expando differently now?

Change History (2)

Changed 11 years ago by dante

Attachment: ep-prog.html added

fixed version

comment:1 Changed 11 years ago by dante

Description: modified (diff)
Priority: highnormal
Resolution: worksforme
severity: blockernormal
Status: newclosed

the only apparent thing i see in your example is you are setting .height and .width properties, and not the style property for those. I've attached a cleaned up version of your test that works for me in trunk. there are a few best practices visualized, as seen by the lines of code commented out.

one thing to note, the attachParent attribute is no longer required to trigger layout, but that should not have had an effect.

also, please in the future attach your testcases as .html files, and include all the requires()'s and whatnot inline. In the description, use "three {'s" to enclose code blocks, as it preserves formatting somewhat.

like this

Note: See TracTickets for help on using tickets.