I've got a structure where you can add persons to a team. Every person belongs to a certain category/subteam. I've tried to add this by a dropdown list as a property of the person document type. My question is, how do you loop over a foreach for the subteams first (sorted by an order that the client can adjust) and after that a foreach for displaying every person.
I can display all the persons so my problem is the adjustment with a subteam and sorting by the order that the client wants...
Where is your code ? Controller action method or a partial razor view.
If razor then isn't it a case of:
a foreach loop on the subteam (ordered by users preference)
a nested foreach loop on the team members ?
If this is way off track then please confirm where you are coding, what code you've got and maybe even a screenshot of the node tree to assist in visualising the structure.
one of the document type with the property "department" that I want to use. Every person belongs to a department so in stead of displaying all the persons at once, I want to display every department with the persons that belong to that department.
Try to group your persons by departments, you can get all departments put them to array, iterate through this array and inside this for each try to loop through persons who are from this department. It should work
After 3 hours of searching i finally found it. Get the prevalues from the dropdown list from the data type ID and with that I've builded the foreach loops you mentioned.
Add category for a person
Hi,
I've got a structure where you can add persons to a team. Every person belongs to a certain category/subteam. I've tried to add this by a dropdown list as a property of the person document type. My question is, how do you loop over a foreach for the subteams first (sorted by an order that the client can adjust) and after that a foreach for displaying every person.
I can display all the persons so my problem is the adjustment with a subteam and sorting by the order that the client wants...
Thanks for tips in advance!
Kind regards,
Benoit
Hi Benoit
Where is your code ? Controller action method or a partial razor view.
If razor then isn't it a case of:
a foreach loop on the subteam (ordered by users preference) a nested foreach loop on the team members ?
If this is way off track then please confirm where you are coding, what code you've got and maybe even a screenshot of the node tree to assist in visualising the structure.
Cheers, Nigel
Hi Nigel,
Below some some screenshots:
Thanks for the help!
Kind regards,
Benoit
Hi Benoit
Try to group your persons by departments, you can get all departments put them to array, iterate through this array and inside this for each try to loop through persons who are from this department. It should work
Thanks,
Alex
Hi,
After 3 hours of searching i finally found it. Get the prevalues from the dropdown list from the data type ID and with that I've builded the foreach loops you mentioned.
Case closed, thanks!
Benoit
is working on a reply...