1

Good morning! I'm not very familiar with querying, or any sort of design related matters with SharePoint, so please bear with me.

If I have a custom document library, and I want to customize a list view by sorting, first, by category, and then sorting by <anotherField>, how would I go about that? I think it should be a web part.... I have an existing web part that only sorts it by category, but I don't know how to do the sub sorting by <anotherField>. I tried looking at the XLS(?) file, but I can't comprehend the code.

If you could point me in the right direction, I'd appreciate it :)

[As a side question, if you have time, how can I make it so that each category is expandable to show the sorted (by anotherField) items that are each part of category.

IE: If people were nodes (Amy, Age 5, Girl), (Adam, Age 13, Boy), (Ashley, Age 11, Girl), I'd have a list where the initial view is: + Girl + Boy

and upon clicking the [+] sign, it'd expand. So if I clicked [+] next to Girl, it'd show all girls, sorted by age.

Edit: To show what I've tried, I've tried to alter the existing library that I spoke of by having the new field "<anotherField>" and setting it in the settings of the library to sort, first by category, and then by <anotherField>. In the document library view, it shows the way I want it sorted, but the web part is currently still only sorting by the first criterion, so I am trying to find where it's pulling the information or formatting itself so that I can hopefully edit it.

1 Answer 1

2

perhaps you may want to try and get away just with whatever is provided out of the box

if you have 3 columns: name, age, gender

you can "group" views just as you can filter and sort. you will want to group by gender, then by age, and perhaps a last group by based on name

if you just want two levels you can create a calculated column that joins age and name and group by based on that column instead, on the second level

a single sort condition based on age should be enough

2
  • Boy, would I love to take the OOTB view :) But there's a branding .... I guess .... 'image' associated with the site (document libraries included) that I'm working with. I'm trying to take some stress off my boss and get it worked out. When I view the document library, I have already grouped things using the setting 'primary sort by:' and then 'secondary sort by:', though it doesn't show. My quick fix is to remove everything and upload until a new document next year needs to be added to this, but.... :( It's just a workaround. Thanks for answering, though :) Aug 4, 2014 at 12:50
  • **Sorry for the long background story. When I meant to say is: the document library is sorted in the document library itself. It's just the view (web part) doesn't show this change. I've never looked at this XLS format before, which is my only guess as to how the web part was created. Aug 4, 2014 at 12:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.