简体   繁体   English

dojo:如何在contentpane中创建两个或两个以上的单选按钮?

[英]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". 我必须使用dojo内容窗格“ Programmatic”而不是“ declarative”来创建两个或两个以上的Radio按钮。

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, 我不应该为此做一个“ div”,

I know its a very dumb question, Can anyone help? 我知道这是一个非常愚蠢的问题,任何人都可以帮忙吗? Thank you very much. 非常感谢你。

Let me answer in a proper form ; 让我以适当的形式回答; )

  1. use dojo.create to create new div tag 使用dojo.create创建新的div标签
  2. insert your radio button in this new tag 在此新标签中插入您的单选按钮

I solved it with the help as per @h4b0 user's comments 我按照@ h4b0用户的评论通过帮助解决了

" it's not a problem, have you heard about dojo.create? dojotoolkit.org/reference-guide/1.7/dojo/create.html " “这没问题,您听说过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 谢谢h4b0

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用按钮检查两个或多个无线电组 - use buttons to check two or more radio groups 在Dojo中,如何实用地创建与TabContainer共享相同结构的ContentPane? - In Dojo, how to create ContentPane pragmatically which share the same structure for TabContainer? 如何检查两组单选按钮是否匹配 - How to check if two sets of radio buttons match 如何使用两个单选按钮隐藏两个文本框的显示 - How to make a show hide of two textboxes using two radio buttons 如何在下拉自定义列表单选按钮中添加两个以上的选项? - How to add more than two options in a drop down custom list radio button? 在 React 中从两组不同的“单选按钮”创建一个总数 - Create a total from two different groups of 'radio buttons' in React 如何在HTML表单中创建两组单选按钮,并且当A组中的更改将在B组中更改时? - How can I create two groups of radio buttons in a HTML form and when change in A Group will change in B Group? 如何以编程方式滚动到Dojo contentPane中的某个元素 - How to scroll to a certain element in dojo contentPane programatically 如何在BorderContainer(Dojo)中动态调整ContentPane的大小 - How to dynamically resize ContentPane inside BorderContainer (dojo) 如何在已解析的dojo ContentPane中使用dijit require - How to use dijit requires in parsed dojo ContentPane
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM