开发者

Show div for every object in array

开发者 https://www.devze.com 2023-02-18 00:15 出处:网络
I am new to Dojo and I need help. I have JSON file and inside array objects ( with properties name, type, status ) and I need to show something like one div with this data for every object which is in

I am new to Dojo and I need help. I have JSON file and inside array objects ( with properties name, type, status ) and I need to show something like one div with this data for every object which is inside array. What widget to use ? How to achive this ? (if I have

{
    "elements": [
        {
            "name": "a",
            "type": "A",
            "status": "active" 
 开发者_开发问答       },
        {
            "name": "b",
            "type": "B",
            "status": "reactive" 
        } 
    ] 
}

how to vizualize this ?)


Shouldn't it be something simple like:

dojo.forEach(jsonData.elements, function(element) {
    dojo.create("div", { name:element.name, type:element.type, status:element.status }, containerDiv);
});
0

精彩评论

暂无评论...
验证码 换一张
取 消