0

嗨,我如何将gathertests.php 中的记录填充到dijit/select 中?我不认为我应该使用innerHTML,因为那样不会构建dijit/select。也许我应该使用该功能。但是怎么做?

request.post('gathertests.php',{
    data:{testx : selectX.value},
}).then
    {
    function(response){   dom.byId('line4').innerHTML=response;                         
},
function(error){
    alert(error);
});

请告知谢谢克莱门特

4

1 回答 1

2

创建dojo/store/Memory或理想情况下dojo/store/JsonRest并将商店分配给dijit/Select.

不要直接操作 DOM,改变dojo/store(即模型)中的数据,dijit 观察它并相应地更新 DOM。

请参阅Dojo 声明式与编程式创建 Select 元素与商店和相关jsFiddle的回答。

奖励:一个更复杂的例子:http: //jsfiddle.net/phusick/N8DqG/

于 2013-02-21T10:58:30.833 回答