Opened 13 years ago

Closed 12 years ago

Last modified 12 years ago

#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 12 years ago by bill

Component: WidgetsDijit
Owner: changed from bill to koranteng

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.

comment:2 Changed 12 years ago by bill

Milestone: 2.0
Summary: bottom-aligned ContentPane may be incorrectly aligned after content is changedLayoutContainer: bottom-aligned ContentPane may be incorrectly aligned after content is changed

comment:3 Changed 12 years ago by bill

Resolution: wontfix
Status: newclosed

OK, for bottom/top components in layout you need to specify a height. That's a requirement.

comment:4 Changed 12 years ago by alex

Milestone: 2.01.3

Milestone 2.0 deleted

Note: See TracTickets for help on using tickets.