1

Suppose I have a SharePoint list with a choice column "Department". Department has the following choices: Executive, Admin, Sales, Accounting, IT

I want to do a group by on this column, but the headers get sorted alphabetically, like so:

  • Accounting
    • Entries
  • Admin
    • Entries

and so on.

I would like to sort the groups on a different column (DepartmentSort), to keep them in the above order

  • Executive
    • Entries
  • Admin
    • Entries

and so on.

I know I could make the entries "1. Executive", "2. Admin", "3. Sales", but I am trying to not do this.

My searching on this topic points to XSLT, but I have to admit, I'm quite lost.

  • I think there is a similar post to this in SharePoint Stackexchange. Check this link sharepoint.stackexchange.com/questions/61752/… – Alvmad Oct 7 '13 at 11:14
  • This is similar, but not the same. That is grouping by multiple columns. I would like to group by one column, but use a different column as the header. – Mike Christiansen Oct 7 '13 at 14:40
1

Just a warning. You can not use JavaScript after the page is rendered to change the field as it will break the grouping function in the default list view.

Two good choices:

  1. Use SharePoint Designer and edit the XSL directly to change the text values.
  2. Use JavaScript/HTML and recreate your own your list and get full control of how it is displayed. I would look at using SPServices() for pulling in the data and maybe one of the JQuery plug-ins for dynamic tables.
1

I solved this, using Jesus Shelby's first suggestion. Tedious, but it works. Details:

Assumptions: I have a list with two columns, Header, and HeaderSort. I want to sort the groups by HeaderSort, but display Header as the group title.

Steps:

  • Add a Data View Web Part, tied to the list in question. Columns (except group title and group sort columns) are added to the view.
  • Configure grouping to group by the group sort column
  • Switch to split view (code and design) for ease of editing
  • Select the group title (i.e., the Header Sort column name for the first group)
  • Change the xsl:value-of tag to just the desired group title (static rather than dynamic)
  • Select the group value (i.e., the Header Sort value for the first group)
  • change the xsl:value-of tag to equal @HeaderTitle column instead of $fieldvalue

Tedious to do for each view rather than having a built-in way, but it works.

Accepted Jesus Shelby's answer because its the most right solution that isnt my answer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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