Opened 10 years ago

Closed 10 years ago

#10172 closed defect (wontfix)

TabContainer inside templated+widgetsInTemplate widget inside Dialog doesn't layout correctly

Reported by: vorun Owned by: bill
Priority: high Milestone: 1.4
Component: Dijit Version: 1.4.0b
Keywords: Cc:
Blocked By: Blocking:

Description (last modified by bill)

below is the example:

dojo.declare("dijit.TestWidget",
			[dijit._Widget, dijit._Templated], 
		{
			templateString: dojo.cache("dijit", "tests/TemplateTest.html"),
			widgetsInTemplate : true
		});	
<div dojoType="dijit.Dialog" id="tabDialog" title="TabContainer Dialog">
		<div dojotype="dijit.TestWidget" style="width:400px; height:400px;"></div>
	</div>

TemplateTest?.html /

<div>    
    <div dojoType="dijit.layout.TabContainer" style="width:400px; height:400px;">
        <div dojoType="dijit.layout.ContentPane" title="tab 1">
        </div>
        <div dojoType="dijit.layout.ContentPane" title="tab 2">
        </div>
    </div>
</div>

Attachments (4)

TemplateTest.html (273 bytes) - added by bill 10 years ago.
template file
DialogTab.html (1.2 KB) - added by bill 10 years ago.
main file
TemplateTest.2.html (312 bytes) - added by bill 10 years ago.
test file (working)
DialogTab.2.html (1.4 KB) - added by bill 10 years ago.
test file (working)

Download all attachments as: .zip

Change History (6)

Changed 10 years ago by bill

Attachment: TemplateTest.html added

template file

Changed 10 years ago by bill

Attachment: DialogTab.html added

main file

comment:1 Changed 10 years ago by bill

Description: modified (diff)
Milestone: tbd1.4
Owner: set to bill
Status: newassigned

OK I'll take a look. For the future please attach testcases using the "attach file" button.

comment:2 Changed 10 years ago by bill

Resolution: wontfix
Status: assignedclosed
Summary: TabContainer doesnt work in Dialog when using templateStringTabContainer inside templated+widgetsInTemplate widget inside Dialog doesn't layout correctly

I don't think I can "fix" this but there's a workaround, or rather, a requirement about how you write your templated widget when that widget contains layout widgets. I'll attach modified code that works.

The problem is that TabContainer.resize() is called while the dialog is hidden (style="display: none"), and that won't work.

Need to change it so the Dialog, when shown, will call TestWidget.resize(), which will then call TabContainer.resize(). In your TestWidget:

isLayoutContainer: true,// signify that i'll call resize on my children
resize: function(){
 	this.embeddedTabContainer.resize();
}

Of course you need that attach point in your template:

<div dojoType="dijit.layout.TabContainer" ... dojoAttachPoint="embeddedTabContainer">

Changed 10 years ago by bill

Attachment: TemplateTest.2.html added

test file (working)

Changed 10 years ago by bill

Attachment: DialogTab.2.html added

test file (working)

Note: See TracTickets for help on using tickets.