I am using view formatting with JSON and wondering if its possible to add button that can sort, hide and show other rows based on their column value, like only show items in toys department store and hide other departments, sports, etc.

3 Answers 3


You can create links to your view with filter query strings. Here's an example of how to do that with a multi-choice field:

  "elmType": "a",
  "txtContent": "=join(@currentField,', ')",
  "attributes": {
    "href": "=@currentWeb + '/lists/Allies/Orderable.aspx?FilterFields1=Drinks&FilterOp1=Eq&FilterValues1=' + join(@currentField, '%3B%23')"

In the example above, the list name is Allies, the view is Orderable.aspx, and the internal column name is Drinks all of which are hardcoded in the format as there isn't yet a way to pull this information from context.

You can do the same with sorting by using additional query strings. For example adding sortField=PhoneNumber&isAscending=true would sort the view by the column with the internal name of PhoneNumber.

The easiest way to make sure you're getting these query string values right, is to apply filters and/or sorts to your view and note the query strings applied in the URL. Then build your links using those and plug in dynamic values (from the current list item) as needed.


As far as I know,if we want to hide an item in list,we need to add Conditional class to list, but there is no original class that can hide the item.
All classes we can use: enter image description here Of course,we could use custom class,then we need to inject our custom css through spfx. https://tahoeninjas.blog/2018/05/08/inject-custom-css-on-sharepoint-modern-pages-using-spfx-extensions/


I think this is not possible using JSON view formatting as you cannot get the column values from another rows/list items in JSON code.

You can only access the column values from the same list item/row like [$AnotherColumnFromSameRow].

Where AnotherColumnFromSameRow is internal name another column from same list item/row. You can get the internal name of your column by following this article: How to find the Internal name of columns in SharePoint Online?

Official documentation: Use view formatting to customize SharePoint

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.