Grouping documents in Sanity.io using parent/child relationship and customization of default list.
Last updated: Dec 2, 2022
Is there a way to group documents? I have something for categories where I followed the Parent/Child relationship guide . I guess I just follow that anytime I want something to be grouped?
Nov 29, 2022, 12:21 AM
Are you looking to group documents within a single list? That would be possible, but you'd need to do some customization to the default list to get it to work. However, if you're ok with having them under separate list items and in separate lists, you'll want to use this method.
Nov 29, 2022, 12:27 AM
I basically want to see “Schools” in the list like it is and then when I click on it I would see Division A and Division B. Then clicking Division A I would see all the schools that fall under Division A and the same for Division B
Nov 29, 2022, 12:35 AM
But these schools could switch divisions so I don’t want to hard code it
Nov 29, 2022, 12:36 AM
Got it! You'd want to use the method I shared then. How are divisions shown in your schools?
Nov 29, 2022, 12:37 AM
Well those divisions are sacristy the two parent categories you see in the categories screenshot 😅
Nov 29, 2022, 12:38 AM
You'd want to do something like this (if the division is a document that's referenced by a school):