Ticket #5169 (new enhancement)

Opened 12 months ago

Last modified 2 months ago

dojox.layout.ContentPane with LayoutContainer abilities

Reported by: guest Owned by: peller
Priority: normal Milestone: future
Component: Dijit Version: 1.0
Severity: normal Keywords: layouting contentpan
Cc:

Description (last modified by peller) (diff)

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

Changed 12 months ago by bill

  • status changed from new to closed
  • resolution set to fixed
  • description modified (diff)
  • milestone set to 1.0

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?

Changed 12 months ago by guest

  • status changed from closed to reopened
  • resolution deleted

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.)?

Changed 12 months ago by bill

  • owner changed from ttrenka to bill
  • status changed from reopened to new
  • component changed from Dojox to Dijit
  • milestone changed from 1.0 to 1.1

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.

Changed 10 months ago by bill

  • owner changed from bill to peller
  • milestone changed from 1.1 to 2.0

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.

Changed 9 months ago by alex

  • milestone changed from 2.0 to 1.3

Milestone 2.0 deleted

Changed 2 months ago by peller

  • description modified (diff)
  • milestone changed from 1.3 to future
Note: See TracTickets for help on using tickets.