Back to All

Item card and nested json array

Item card cannot show nicely nested array details. My colleague had information that he wanted to show to the end user. I suggested to create a more details button to the item and make a form that would show the more details. This solution we ended up.

I noticed that this solution could be handy for others also who have nested arrays in their item.attribute.nestedarrayjsondata, maybe Onify support want to put this solution to the forms section how to show static nested json data from item card.

block append formConfig
-var box = form.items[0]

if(mailbox.attribute.nestedarraygroup)
-var groupsarray = JSON.parse(box.attribute.nestedarraygroup)
else
-var groupsarray = 'none'

+formOptions({
    formDescription: box.attribute.displayname,
    pageTitle: 'Box details',
    formTitle: box.name,
    hideSubmitButton: true,
    backButtonName: t('back'),
})

block formContent

if(groupsarray.groupname)
    table(style='width:100%',border='0')
        tr
            th(style='width:40%') <b>Resource group:</b>
            th <b>Nested groups:</b>
        tr
            td #{groupsarray.groupname}
            td #{groupsarray.groups}