Opened 12 years ago

Closed 4 years ago

#5169 closed enhancement (patchwelcome)

dojox.layout.ContentPane with LayoutContainer abilities

Reported by: guest Owned by: Adam Peller
Priority: high Milestone: 1.13
Component: DojoX Layout Version: 1.0
Keywords: layouting contentpan Cc:
Blocked By: Blocking:

Description (last modified by Adam Peller)

I'm in need for a ContentPane? that loads its content remotely and acts as a LayoutContainer? for all its loaded widgets. I didn't find a solution with the standard widget set, so I created one on my own. Perhaps there's a chance to get this abilities into dojox.layout.ContentPane? directly. Here is my snippet of code for the widget.

dojo.provide("tas.LayoutContentPane")

dojo.require("dijit.layout.LayoutContainer");
dojo.require("dojox.layout.ContentPane");

dojo.declare("tas.LayoutContentPane", 
							[dojox.layout.ContentPane,dijit.layout.LayoutContainer],
{
postCreate : function() {
dojox.layout.ContentPane.prototype.postCreate.apply(this, arguments);
dijit.layout.LayoutContainer.prototype.postCreate.apply(this, arguments);
}
,startup	: function(){
dojox.layout.ContentPane.prototype.startup.apply(this, arguments);
dojo.connect(this,"onLoad",this,"startupChildren")
}

,layout : function() {
tas.LayoutContentPane.superclass.layout.call(this,arguments)
}
,startupChildren : function() {
if(this.getChildren){
dojo.forEach(this.getChildren(), function(child){ child.startup(); });
}
this.layout()
}
}
)

I'm not sure whether or not that code is optimized for dojo. It simply works for me. Perhaps one could have a look onto it. I will repost this at the dojox developer forum for better code highlighting.

Change History (8)

comment:1 Changed 12 years ago by bill

Description: modified (diff)
Milestone: 1.0
Resolution: fixed
Status: newclosed

Hi, as a last minute change in 1.0 I added the ability for ContentPane? to load from an href and have a single layout widget (LayoutContainer?) as it's child, see #4826. I think that satisfies your needs? I guess your code is slightly more convenient because it's one widget instead of two (a ContentPane? which loads a LayoutContainer?), but basically the same, right?

comment:2 Changed 12 years ago by guest

Resolution: fixed
Status: closedreopened

ah, that was quick! I think you mean the _singleChild thing, in the dijit.layout.ContentPane?, right? I saw this, but it seemed not to work for me. Perhaps it's all about my document's structure I load into the contentpane. It looks like this:


<script>
..something to be done 
</script>
<div dojoType="dijit.layout.LayoutContainer">
... more html and widget markup; this one is what will be visible to the user
</div>
<div style="display:none">
.."ghostcontainer" with markup data.store()s, markup toolbar options
</div>

In Firebug I traced what children the CP found, and there the SCRIPT-Node appeared also, so the CP was not willing to startup the LayoutContainer?. I will try again, by packing all into the dijit.layout.LayoutContainer?, so that there will remain only one child. But perhaps it would be a good idea, for the CP to only look for real _widgets_ as children, and skip all other HTML-nodes (simple DIVs, SCRIPT,STYLE, etc.)?

comment:3 Changed 12 years ago by bill

Component: DojoxDijit
Milestone: 1.01.1
Owner: changed from Tom Trenka to bill
Status: reopenednew

Hmm, that's a good point. The reason it works the way it does it to avoid something like this from expanding the NumberTextBox? to the full width/height of the ContentPane?:

<div dojoType=ContentPane>
   Enter your age: <input dojoType=NumberTextBox>
</div>

But your example above shows a deficiency in the current design, so something needs to be done (like you said). Actually I like the idea you had of having another widget (LayoutContentPane? or whatever) to make it explicit what behavior the user wants, but the problem is that even if we did have such a widget, I would still get one or more bug reports per week claiming that the layout widgets were broken, because the user had put a layout widget in a ContentPane?.

So I'll leave this bug open, and mark for dijit, so we can do something (not sure what yet) better than what we have now.

comment:4 Changed 12 years ago by bill

Milestone: 1.12.0
Owner: changed from bill to Adam Peller

I filed #5676 to try to improve the behavior of ContentPane?. As to address the actual thing you wrote at the beginning of this ticket, maybe we could add an href parameter (and setHref() method) to BorderContainer?, maybe after #5647 is fixed. Not sure if it's worth doing that or not but let's think about it.

comment:5 Changed 12 years ago by alex

Milestone: 2.01.3

Milestone 2.0 deleted

comment:6 Changed 11 years ago by Adam Peller

Description: modified (diff)
Milestone: 1.3future

comment:7 Changed 9 years ago by bill

Component: DijitDojoX Layout

comment:8 Changed 4 years ago by dylan

Milestone: future1.12
Resolution: patchwelcome
Status: newclosed

Given that no one has shown interest in creating a patch in the past 8 years, I'm closing this as patchwelcome.

Note: See TracTickets for help on using tickets.