value = system.tag.read("[default]Pre-Processed Datasets/rostersAndUsersDS").value
accordianList = []
headers = ['UserID', 'Username', 'Fullname', 'Email', 'Phone', 'SMS', 'Schedule', 'RemoveUser']
for row in range(value.getRowCount()):
userData = []
rosterData = []
rosterUsersDS = system.util.jsonDecode(value.getValueAt(row,'rosterUsers'))
for user in rosterUsersDS:
userData.append([user['userID'], user['username'], user['fullName'], user['email'], user['phone'], user['sms'], user['schedule'], 'X'])
finalUserDS = system.dataset.toDataSet(headers, userData)
rosterData.append(value.getValueAt(row, 'rosterID'))
rosterData.append(value.getValueAt(row, 'roster'))
rosterData.append(value.getValueAt(row, 'Type'))
rosterData.append(value.getValueAt(row, 'Region'))
rosterData.append(value.getValueAt(row, 'Yard'))
accordianList.append({
"expanded": False,
"header": {
"toggle": {
"enabled": True,
"expandedIcon": {
"path": "material/expand_less",
"color": "",
"style": {
"classes": ""
}
},
"collapsedIcon": {
"path": "material/expand_more",
"color": "",
"style": {
"classes": ""
}
}
},
"content": {
"type": "view",
"text": "",
"useDefaultViewWidth": False,
"useDefaultViewHeight": False,
"viewPath": "MainScreens/User_Roster Management/Carousel_Views/accordianHeader",
"viewParams": {"rosterDetails": rosterData},
"style": {
"classes": ""
}
},
"height": "40px",
"reverse": False,
"style": {
"classes": ""
}
},
"body": {
"viewPath": "MainScreens/User_Roster Management/rosterMembers",
"viewParams": {"rosterMembers": finalUserDS, "rosterID": value.getValueAt(row, 'rosterID')},
"useDefaultViewWidth": False,
"useDefaultViewHeight": False,
"height": "auto",
"style": {
"classes": "",
"margin": "16px"
}
}
})
self.custom.accordianData = accordianList
self.custom.dataLength = len(accordianList)
accordianListDemo = accordianList[self.custom.dataIndex - 50:self.custom.dataIndex]
self.getChild("rosterTableC").getChild("Accordion").props.items = accordianListDemo