Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8082077
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T16:57:41+00:00 2026-06-05T16:57:41+00:00

Please bear with me as I am new to dojo, javascript, and web programming

  • 0

Please bear with me as I am new to dojo, javascript, and web programming in general.

In a part of the web page I am working on, I have a BorderContainer (inside of a TabContainer, which is inside of another BorderContainer, but I don’t think this is relevant to the issue) and I want to put a number of widgets inside it.

I am using the “headline” design on the BorderContainer and – ideally – I would like to have a ContentPane in the center region and a TextBox and four buttons all in the bottom region (lined up side-by-side across the width of the border container).

This could be a very basic idea that I am missing behind BorderContainers or widgets in general (or even in basic paradigms of web programming!), but I am having trouble getting the TextBox and four buttons to line up side-by-side as I would like.

Is it possible for me to put different widgets in the same region without creating another BorderContainer (or other Container or Pane for that matter) just for that region? If so, how would I implement this?

Here are some snippets of creating the BorderContainer and it’s future components.

    //Main BorderContainer
    this.container = new dijit.layout.BorderContainer({
        title: that.name + "_CTR",
        style: "height: 100%",
        design: "headline"
    }, that.name + "_CTR"); 

    //Blank ContentPane in the center region
    this.msgArea = new dijit.layout.ContentPane({
        content: "",
        region: "center"
    }, that.name + "_MSGS");

    //TextBox to be placed in the "bottom" region
    this.textBox = new dijit.form.TextBox({
        value: "",
        placeHolder: "Type a message to publish",
        region: "bottom"
    }, that.name + "_TB");

    //Example of one of my four buttons also to be placed in the "bottom" region
    this.pubButton = new dijit.form.Button({
        region: "bottom",
        label: "Publish",
        showLabel: true,
        onClick: function () { that.publish(); }
    }, that.name + "_PB");

    //Function that adds children to the main BorderContainer and calls startup()
    this.initialize = function () {
        that.container.addChild(that.msgArea);
        that.container.addChild(that.textBox);
        that.container.addChild(that.pubButton);
        that.container.addChild(that.pubButton2);
        that.container.addChild(that.pubButton3);
        that.container.addChild(that.pubButton4);

        that.container.startup();
    };

Thank you for your time!

EDIT: Forgot to mention that I would prefer doing this programmatically if possible

EDIT2: Big thanks to Craig below! While I didn’t use your exact methods, playing around with dojo.create (haven’t converted to 1.7 yet…) helped me learn more about DomNodes (like I said, I’m new to web programming :P), which allowed me to figure out that more than one widget could take the place of the ContentPane’s “content” property simply by setting it to an array of domNode references for each widget!

    //Create BorderContainer and Buttons as above

    //Create the ContentPane for the bottom region of the BorderContainer
    this.pane = new dijit.layout.ContentPane({
        content: "",
        region: "bottom"
    }, that.name + "_BTM");

    //Add each widget to the ContentPane's "content" by using a DomNodeList
    //Then add the ContentPane to the BorderContainer
    this.initialize = function () {
        that.pane.set("content", [
            that.textBox.domNode, 
            that.button1.domNode,
            that.button2.domNode,
            that.button3.domNode,
            that.button4.domNode
        ]);

        that.container.addChild(that.pane);

        that.container.startup();
    };

This quick and dirty method might not be best for markup/layout, in which case I think your methods and/or editing of the “innerHTML” might work out better, but this is what I needed at the moment.

Many thanks once again, wish I was able to upvote/give reputation….

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T16:57:46+00:00Added an answer on June 5, 2026 at 4:57 pm

    Yes you can put multiple widgets in the same region, except for the center region. Notice that the first widget added is farthest most in the direction specified by the region. The first top widget is on top. The first bottom widget is on the bottom, and so on.

    http://jsfiddle.net/cswing/ssDXh/

    Looking at your example, I would recommend putting the textbox and button into it’s own content pane and then putting the pane into the bordercontainer. The bordercontainer will adjust the sizes of the regions based on screen size, and you don’t want the button and textbox changing size.

    EDIT:

    There are two techniques you can consider to accomplish what was asked in the comment.

    1) You can use dom-construct to manually build the html and then instantiate a widget using a newly created domNode.

    var b1 = new ContentPane({});
    var div1 = domConstruct.create('div', {}, b1.containerNode);
    // build more html using domConstruct, like a table etc
    var btn = new Button({ label: 'My Action 1'}, 
                     domConstruct.create('div', {}, div1)); 
    

    2) You can create a templated widget that has the html markup and the widget is then responsible for instantiating the text box and button.

    dojo.declare("MyFormLayout", [dijit._Widget, dijit._Templated], {
    
        //put better html layout in the template
        templateString: '<div><div dojoAttachPoint="btnNode"></div></div>',
    
        postCreate: function() {
            this.inherited(arguments);
            this.button = new Button({ label: 'My Action 2'}, this.btnNode);
        }
    });
    
    appLayout.addChild(new ContentPane({
        region: "bottom",
        content: new MyFormLayout({})
    }));
    

    The first option is convenient if the markup is simple and strictly for layout.
    The second option works well when there is other logic that is coded for the widgets. That code can go in the custom widget.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am absolutely new to javascript, so please bear with me. I have 50
I'm new to Javascript and extJS, so please bear with me. I have a
I am new to Javascript so please bear with me. I have a Javascript
I am new to JavaScript OO programming please bear with me for any ambiguities.
I am new to Ruby and Rails so bear with me please. I have
I am new to iOS development so please bear with me. I have created
New to Castle/Windsor, please bear with me. I am currently using the framework System.Web.Mvc.Extensibility
I am new to sql and programming so please bear with me. Is there
Im very new to javascript and jquery so please bear with me. Here's my
New to MySQL, so please bear with me. I'm working on a project that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.