use(
[“/libs/wcm/foundation/components/utils/AuthoringUtils.js”],
function (AuthoringUtils) {
var itemList = granite.resource.properties[“items”];
var itemArray = [];
if(itemList != null) {
if( itemList.getClass().isArray() ) {
for (var i = 0, l = itemList.length; i < l; i++) {
var temp = JSON.parse(itemList[i]);
itemArray.push(temp.text);
}
}
else {
var temp = JSON.parse(itemList);
itemArray.push(temp.text);
}
}
return {
itemArray : itemArray
};
});
You can also look at this approach as well - https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/coral-ui-multifield-in-aem-6-3-sightly-js-use-api/m-p/289270/highlight/true#M17657
ReplyDelete