#1925 closed defect (invalid)
Problem using widgetsInTemplate with LayoutContainer
Reported by: | Owned by: | anonymous | |
---|---|---|---|
Priority: | high | Milestone: | |
Component: | General | Version: | 0.4 |
Keywords: | Cc: | ||
Blocked By: | Blocking: |
Description (last modified by )
Hello Dojo team,
I have asked this question on the mailing list, but didn't get any valuable help. It really seems there is a bug in dojo here. If it is a user error of if you have any workaround, please send me an email.
What I am trying to do is implement a custom widget using a LayoutContainer? (widgetsInTemplate=true). It simply does not work: the layout is not changed. I also have a dojo button in the template and this one is processed ok.
The very simple code snippet below will allow you to reproduce the pb. To test it, just copy it in the dojo/tests/widget directory.
Thanks
Yann
<html xmlns:dojo xmlns:myown> <head>
<script type="text/javascript">
var djConfig = {isDebug: true};
</script> <script language="JavaScript?" type="text/javascript" src="../../dojo.js"></script>
<script>
dojo.require('dojo.widget.HtmlWidget?'); dojo.require("dojo.widget.LayoutContainer?"); dojo.require("dojo.widget.Button"); dojo.require("dojo.widget.ContentPane?"); dojo.require("dojo.widget.Button"); dojo.registerNamespace("myown", "myown");
</script> </head> <body>
<xmp id="Test1Template" style="display:none">
<div dojoType="LayoutContainer?" style="width:100%;height:100%">
<div style="background-color:cyan" dojoType="ContentPane?" layoutAlign="left"> <button dojoType="Button">PressMe?</button><p> bvlfdlfdldf<p> </div> <div style="background-color:yellow" layoutAlign="client" dojoType="ContentPane?"> bla<p>bla<p>bla<p>bla<p> </div>
</div>
</xmp>
<script>
dojo.widget.defineWidget('myown.Test1', dojo.widget.HtmlWidget?, {
widgetsInTemplate: true, isContainer: false,
templateString: dojo.byId('Test1Template').textContent dojo.byId('Test1Template').innerText,
});
</script>
<hr>
<h1>Code using a template (LayoutContainer? does not work)</h1>
<div style="width: 400px; height: 300px">
<div dojoType="myown:Test1" widgetId="test1Widget" ></div>
</div>
</hr>
<h1>Regular Code (LayoutContainer? works ok)</h1>
<div style="width: 400px; height: 300px">
<div dojoType="LayoutContainer?" style="width:100%;height:100%">
<div style="background-color:cyan" dojoType="ContentPane?" layoutAlign="left"> <button dojoType="Button">PressMe?</button><p> bvlfdlfdldf<p> </div> <div style="background-color:yellow" layoutAlign="client" dojoType="ContentPane?"> bla<p>bla<p>bla<p>bla<p> </div>
</div>
</div>
</body> </html>
Change History (2)
comment:1 Changed 14 years ago by
Description: | modified (diff) |
---|---|
Resolution: | → invalid |
Status: | new → closed |
comment:2 Changed 14 years ago by
No I am not misunderstanding. What I want is really create a widget, not use one. The code shown here has been overly simplified (no attachpoint, no event) to show only what was my pb.
Anyway, I've found the answer: the LayouContainer? was missing the attachpoint
dojoAttachPoint="domNode"
So it is ok to leave the ticket as closed.
Thanks anyway
Yann
You're misunderstanding what widgetsInTemplate is for. That's a flag for people writing their own widgets. You are not writing widgets; you're just using widgets.