#2586 closed defect (wontfix)
LayoutContainer: bottom-aligned ContentPane may be incorrectly aligned after content is changed
Reported by: | guest | Owned by: | koranteng |
---|---|---|---|
Priority: | high | Milestone: | 1.3 |
Component: | Dijit | Version: | 0.4.1 |
Keywords: | ContentPane, layout, LayoutContainer | Cc: | |
Blocked By: | Blocking: |
Description
If a bottom-aligned ContentPane? is given new content that has a different height than the prior content, the pane will stay at the old location until a resize occurs. I have tested with FF 1.5 and IE 6, and have used dojo-ajax-0.4.1 as well as the 2007-02-12 nightly build.
I can work around this problem by having the containing LayoutContainer? refresh its layout after the content is changed, but this is inconvenient and seems like something the framework should provide.
Sample code to observe the problem (click the test button and observe that the new, shorter content is not bottom-aligned):
<html> <head> <script type="text/javascript"> var djConfig = { isDebug: true }; </script> <script type="text/javascript" src="js/dojo/dojo.js"></script> <script type="text/javascript"> dojo.require("dojo.event.*"); dojo.require("dojo.widget.*"); function swap() { dojo.widget.byId('bottom').setContent('This should be at the bottom'); } dojo.addOnLoad(function(){ dojo.event.connect(dojo.byId("button"), "onclick", "swap"); }); </script> </head> <body> <button id="button" name="test">test</button> <div id="parent" dojo:type="LayoutContainer" dojo:layoutChildPriority="top-bottom" style="width: 100%; height: 80%; overflow: hidden; border : solid 1px #aaa;" > <div id="top" dojo:type="ContentPane" dojo:layoutAlign="client"> This is the top. </div> <div id="bottom" dojo:type="ContentPane" dojo:layoutAlign="bottom"> This is the bottom.<br>foo<br>bar </div> </div> </body> </html>
One possible solution: in ContentPane?.onLoad, something like the following:
var parent = this.parent; while (parent && !(parent instanceof dojo.widget.LayoutContainer)) parent = parent.parent; if (parent) dojo.widget.html.layout(parent.domNode, parent.children, parent.layoutChildPriority);
Change History (4)
comment:1 Changed 14 years ago by
Component: | Widgets → Dijit |
---|---|
Owner: | changed from bill to koranteng |
comment:2 Changed 14 years ago by
Milestone: | → 2.0 |
---|---|
Summary: | bottom-aligned ContentPane may be incorrectly aligned after content is changed → LayoutContainer: bottom-aligned ContentPane may be incorrectly aligned after content is changed |
comment:3 Changed 13 years ago by
Resolution: | → wontfix |
---|---|
Status: | new → closed |
OK, for bottom/top components in layout you need to specify a height. That's a requirement.
Hmm, not sure if we ever want to support something like this, given that you can just call layout() on the parent layout container again. Let's think about it.