简体   繁体   中英

Show div for every object in array

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);
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM