1

Dojo TabContainer のラベルにチェックボックスを入れたいです。ここで例を見つけました:

http://telliott.net/dojoExamples/dojo-checkboxTabExample.html

ただし、この例では html のみを示しています。これをプログラムで実行したいと思います。これは私がこれまでに持っているものです:

function(response){
    var json_response = JSON.parse(response);
    var fields_dict = json_response['fields_dict'];
    var names_dict = json_response['names_dict'];
    var tc = new TabContainer({
        style: "height: 495px; width: 100%;",
        tabPosition: "left",
        tabStrip: true
    }, "report_tab_container");
    for(var key in fields_dict) {
        var content_string = '';
        var fields = fields_dict[key];
        for(var field in fields) content_string += '<div>' + fields[field][0] + fields[field][1] + '</div>';
        var checkBox = new CheckBox({
            name: "checkBox",
            value: "agreed",
            checked: false,
            onChange: function(b){ alert('onChange called with parameter = ' + b + ', and widget value = ' + this.get('value') ); }
        }).startup();
        var tcp = new ContentPane({
            //title: names_dict[key],
            title: checkBox,
            content: content_string
        });

        tc.addChild(tcp);
    }

    tc.startup();
    tc.resize();
},

ただし、これは機能しません。ページをロードすると、TabContainer が表示されません。ContentPane のタイトルをチェック ボックス以外に設定すると、問題なく動作します。

何が間違っているのですか? また、TabContainer のタイトルにチェックボックスを表示するにはどうすればよいですか?

4

2 に答える 2

1

これがうまくいきました:

cb.placeAt('report_tab_container_tablist_dijit_layout_ContentPane_'+ i.toString(), "first");
于 2013-08-30T15:30:52.960 に答える