1

In SharePoint Lists you can add a fully functional rating column. With "functional" I mean that you can both see the ratings (value and stars) of every list item and you can click on a star to add your rating for that item. I marked with red in this picture what rating column I'm referring to.

Native ratings in list view

I would like to have the same functional rating embedded into a Grid view. I'm creating the Grid view using the JSON formatting option. This is what I currently created, I'd like to add those functional stars from the list view in the red marked part.

Grid view where I'd like to put the functional rating:

Grid view where I'd like to put the functional rating

3
  • Ratings showed in first image is SharePoint OOTB ratings? Or you have created that using JSON formatting? Nov 16, 2022 at 13:09
  • Those are the OOTB ratings Nov 16, 2022 at 16:03
  • You can try JSON sample given in my answer below. Nov 16, 2022 at 16:08

1 Answer 1

0

Yes, you can create star rating using JSON formatting in SharePoint online.

Check below JSON samples which provides similar functionality: Star Rating

enter image description here

You can refer and use the part of this JSON in your view formatting JSON.


If you have created a custom JSON formatting for your column in list view, you can refer same JSON formatting in view formatting with simple JSON like:

{
  "columnFormatterReference": "[$FieldName]"
}

Where FieldName is the internal name of your Ratings column. Follow this article to find the internal name of your column: How to find the Internal name of columns in SharePoint Online?

6
  • Or you can use JSON in reference link for your Ratings column and then refer same JSON in grid view formatting using columnFormatterReference as shown above. Nov 16, 2022 at 13:16
  • Thanks for your answer Ganesh. With that sample you provided are users able to click the stars to give a rate? Reading its code I understand that it only displays the rating value, but have no way to vote a rate. Nov 16, 2022 at 16:08
  • You can use setValue to update the likes count and users in LikedBy field. Refer this sample for the same: github.com/pnp/List-Formatting/tree/master/column-samples/… Nov 16, 2022 at 16:12
  • I didn't know about setValue, thank you, but the sample you provided manages Likes, but I need to work on Rating. Any user should be able to provide a rate (0-5) and the average of those is the value shown along with the stars. Is that possible? Nov 17, 2022 at 15:25
  • Yes, it is possible. In above link, I am using same logic for like/unlike. It shows total count of all like/unlike. In similar way, you can update SharePoint default LikesCount and LikedBy field using setValue on click of custom rating created using JSON. Nov 17, 2022 at 15:59

Your Answer

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

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