AbdulAziz
AbdulAziz

Reputation: 6298

dojo: How to create two or more than two radio buttons in contentpane?

I am really new to dojo. I have to create two or more that two Radio buttons using dojo content pane "Programmatic" not the "declarative".

I manage to make one radio button but how to make another one, well I am embarrassed, Here I done for one;

var radioButtonPane = new dijit.layout.ContentPane({
            splitter:true,
            region: "top",
            style: "background-color: white;width: 175px; height: 40px",
            content: "RadioButtons"                       
                });
var radioOne = new dijit.form.RadioButton({
            checked: true,
            value: "ProjectOne",
            name: "Project 1",
            }, "radioOne");


 //setting one radio button in content of contentpane, how add another one?
 radioButtonPane.set('content',radioOne);

I should not make a "div" for it,

I know its a very dumb question, Can anyone help? Thank you very much.

Upvotes: 1

Views: 4401

Answers (2)

AbdulAziz
AbdulAziz

Reputation: 6298

I solved it with the help as per @h4b0 user's comments

" it's not a problem, have you heard about dojo.create? dojotoolkit.org/reference-guide/1.7/dojo/create.html"

I replaced my code with this;

var radioOne = dojo.create("div", { 
    innerHTML:"<input type='radio' data-dojo-type='dijit.form.RadioButton' name='Project Cost' id='radioOne' value='Cost' checked: 'true'/>" + "<label for='radioOne'>Project Cost</label><br />" 
    + "<input type='radio' data-dojo-type='dijit.form.RadioButton' name='Project Statistics' id='radioTwo' value='Project_Statistics' checked: 'true'/>" + "<label for='radioOne'>Project Statistics</label><br />"
    + "<input type='radio' data-dojo-type='dijit.form.RadioButton' name='Project Info' id='radioThree' value='Project_Info' checked: 'true'/>" + "<label for='radioOne'>Project Info</label><br />"
});
radioButtonPane.set('content',radioOne);

And its done what I needed. Thank you h4b0

Upvotes: 0

maialithar
maialithar

Reputation: 3123

Let me answer in a proper form ; )

  1. use dojo.create to create new div tag
  2. insert your radio button in this new tag

Upvotes: 1

Related Questions