Skip to content

Can't Group By Content Type with Collapse='TRUE' #5188

@sympmarc

Description

@sympmarc

Category

  • Question
  • Typo
  • Bug
  • Additional article idea

Expected or Desired Behavior

We'd like to be able to set up view which are grouped by Content Type and are collapsed by default. So we use some JSON like this:

        {
          "verb": "addSPView",
          "name": "New View",
          "viewFields": [
            "ContentType",
            "DocIcon",
            "LinkFilename",
            "ReportDate",
            "Modified",
            "Editor"
          ],
          "query": "<OrderBy><FieldRef Name=\"FileLeafRef\" /></OrderBy><GroupBy Collapse='TRUE'><FieldRef Name=\"ContentType\" Ascending=\"TRUE\" /></GroupBy>",
          "rowLimit": 30,
          "isPaged": true,
          "makeDefault": true
        }

Observed Behavior

The resulting view when we apply the Site Design which reference the Site Script snippet from above is grouped by Content Type, but it displays the ContentTypeId rather than the Content Type name.

image

Using the SPInsider Chrome extension, I can see the resulting ViewXML is correct:

<OrderBy><FieldRef Name=\"FileLeafRef\" /></OrderBy><GroupBy Collapse='TRUE'><FieldRef Name=\"ContentType\" Ascending=\"TRUE\" /></GroupBy>

If we don't add Collapse='TRUE', the Content Type name is shown correctly.

image

Steps to Reproduce

Use the JSON snippet above to add a new view to a list or library with or without the Collapse='TRUE' setting.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:site-designCategory: Site Designs/Site Scriptstype:archive-old-issueIssues which are closed as tool old for active worktype:bug-suspectedSuspected bug (not working as designed/expected). See “type:bug-confirmed” for confirmed bugs.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions