3.2.0

setContent method for AW.HTML.DIV object - v2

I'm hoping to use AW to build a page with some nested DIVs with controls (buttons, inputs etc..)

I seem to have trouble with what I'm sure is a basic feature of AW, namely setting the content of the AW.HTML.DIV object.

the following doesn't work for some reason...

var outer_container = new AW.HTML.DIV;
outer_container.setId("outer_div");

var button1 = new AW.UI.Button;
button1.setId("button1");
button1.setControlText("customize grid");

outer_container.setContent("object",button1)
document.write(outer_container);

When I view rendered source in the browser I just have:

<body>

<script>
...
</script>


</body>

Using setContent with text e.g. setContent("text", "this is the out div") works OK.

I've seen several posts that describe using innerHTML to set the HTML contents of a DIV, but i was hoping to do the whole page with AW objects and using them to build nested DIVs etc..

I'm sure I'm doing something trivially wrong?

Will

Will
October 17,
Will,

this behavior is 'by design' - you cannot insert control using setContent method, because control is supposed to be top-level element. However now I think that this original design is too restrictive and your usage scenario makes perfect sense, so lets say this is a bug and it should be corrected. Originally I was planning to create some sort of special 'container' controls, but allowing any html element to 'contain' AW controls would be much better solution.
Alex (ActiveWidgets)
October 17,
Thanks.

The following does achieve having the button control within the DIV:

var container = new AW.HTML.DIV;
container.setId("outer_div");
document.write(container);

var button1 = new AW.UI.Button;
button1.setId("button1");
button1.setControlText("customize grid");

container.element().innerHTML = button1;

(this is like in your dialog.htm example file)

although, I'm struggling to see how to put a further DIV "around" this div/button package ?

Will
Will
October 17,

This topic is archived.

See also:


Back to support forum