3

こんにちは、プログラムで dijit/form/select の各オプションに太字やフォント サイズなどのスタイルを追加するにはどうすればよいですか?

ready(function()//This function won't run until the DOM has loaded and other modules that register have run
{
 parser.parse();
var select_Card = new Select
({options:
[
 {label:"Select Card", value:"", selected:true},
 {label:"Mk7ABC Card", value:"testdata1970_05", selected:false},
 {label:"Mk7CBC Card", value:"testdata1970_10", selected:true},
 {label:"Mk10DC Card", value:"testdata2060_03", selected:false},
 {label:"Mk6BC Card", value:"dbProdigy", selected:false},
 {label:"Mk6NBC Card", value:"dbProdigy_MK6N", selected:false},
], style:{width:'250px'}
}, "select_Card");

select_Card.startup();
    });
    });

助言してください ありがとうクレメント

4

1 に答える 1

7

json 内でラベルのスタイルを設定します。

require(["dojo/ready", "dijit/form/Select"], function(ready, Select){
ready(function(){ 
  var select_Card = new Select({
    options:[
     {label:"Select Card", value:"", selected:true},
     {label:"<b>Mk7ABC Card</b>", value:"testdata1970_05", selected:false},
     {label:"<span style='color:red;'>Mk7CBC Card</span>", 
        value:"testdata1970_10", selected:true},
     {label:"Mk10DC Card", value:"testdata2060_03", selected:false},
     {label:"Mk6BC Card", value:"dbProdigy", selected:false},
     {label:"Mk6NBC Card", value:"dbProdigy_MK6N", selected:false},
    ], style:{width:'250px'}
  }, "select_Card");
  select_Card.startup();
});
});

http://jsfiddle.net/cswing/udJuv/

于 2013-01-15T15:46:38.233 に答える