$(#SharePoint).jQuery(); pt. 2

Pt. 1 Fixing Multi-Choice Column
Pt. 2 Changing Grouped By Views

Pt. 2 Changing Grouped By Views

Another frequent UI correction is to remove the column title in Grouped By views. By default, the Grouped By view will group items together that share a field value. If you have several items, each with a field called Category and a field value of Category 1, those items will be grouped together.

The below items have two fields: Title and Category and are Grouped By Category. So all items with Category 1 are grouped together, all items with Category 2 are grouped together, etc. The goal here is to remove the word “Category” in each grouped section of the Grouped By View, leaving only “Category 1”, instead of “Category: Category 1”.

groupedBy_no_category

Before

groupedBy_category

After

 

 

 

 

 

 

 

 

 

 

 

Like last time, jQuery makes this very simple:

removeGroupedByText

The above function accepts a string to remove and iterates through the each grouped section and removes the text in textToRemove. This text should match the text you want to remove exactly, in the above example textToRemove should be set to “Category” to remove the text Category from the Before screenshot above and produce the After screenshot.

It’s also worth noting that list views allow two levels of grouped sections.

groupedBy_second

Before

groupedBy_second_removed

After

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

removedGroupedByTextSecondLevel

Like the first function this can remove the SecondCategory text. Notice the difference in selectors. Again the text should match exactly the text that you want to remove, in the above Before screenshot the text should be “SecondCategory” to produce the After screenshot.

Credit goes to this thread on stack exchange where I was given the answer.

Advertisements