I am looking for assistance with building a simple unordered list from JSON.
My example payload is as follows:
{
“_id”: “2”,
“cluster_id”: “2”,
“cluster_code”: “3.OA”,
“skills”: [{
“_id”: “0”,
“skill_id”: “784”,
“skill_name”: “Divide by counting equal groups”
}, {
“_id”: “1”,
“skill_id”: “785”,
“skill_name”: “Write division sentences for groups”
}, {
“_id”: “2”,
“skill_id”: “787”,
“skill_name”: “Write division sentences for arrays”
}]
}
I have the following code for the UI:
await getDomainSkills(did).then(json => {
json.forEach( function (j){
j.clusters.forEach( function (clusters) {
cd.push(clusters);
});
return Promise.all();
})
})
.then(() =>$w(“#repeater3”).data = cd)
. catch (err => {
console.log(err);
});
$w(“#repeater3”).onItemReady(($item, itemData, index) => {
//console.log(itemData);
$item(“#text9”).text = itemData.cluster_code;
$item(“#text16”).text = ??
});
In my repeater, I want the following output for each item:
Cluster Code
Divide by counting equal groups
Write division sentences for groups
Write division sentences for arrays
I have tried looping through the data in each pass but, it does not work as expected. If someone can point me in the right direction, I would be eternally grateful.
Thank you!