How To Add Edit Button Under Action In Sharepoint List

If you want to add an edit button under the action in your Sharepoint list, you can utilize the list formatting JSON to achieve this customization. By following a few simple steps, you can enhance the functionality of your Sharepoint list and provide a more seamless user experience.

To begin, you will need to create a customRowAction element in the JSON template. This element allows you to define the actions that will be available under the action column in your list. For the edit button, you can use the “editProps” action, and for the view button, you can use the “defaultClick” action.

Once you have created the customRowAction element, you will need to add a placeholder column to your list or view. This column will serve as the location for your edit button. You can customize the appearance of this column using the JSON templates provided.

Finally, you can implement the edit button by applying the JSON templates for each button. When the edit button is clicked, the list view form will open, allowing users to make changes to the selected item. This method allows you to add custom buttons with the same behavior as the out-of-the-box options, giving you greater control over the functionality of your Sharepoint list.

By following these steps, you can easily add an edit button under the action in your Sharepoint list and provide your users with a more streamlined and efficient editing experience. Take advantage of the list formatting JSON and unlock the full potential of your Sharepoint list.

Creating a CustomRowAction Element

To start adding the edit button under the action, you need to create a customRowAction element in your JSON template. This will allow you to define the desired actions and behaviors for the button. The JSON template acts as a blueprint for your SharePoint list, specifying how it should be displayed and interacted with.

Within the customRowAction element, you can use the “editProps” property to define the action for the edit button. This property determines what happens when the button is clicked. Similarly, you can use the “defaultClick” property to specify the action for the view button.

Here’s an example of how the customRowAction element can be structured in your JSON template:

{
    "elmType": "span",
    "style": {
      "padding-right": "8px"
    },
    "attributes": {
      "class": "sp-field-quickAction"
    },
    "children": [
      {
        "elmType": "a",
        "attributes": {
          "class": "ms-fontColor-themePrimary",
          "href": {
            "event": "editRow"
          },
          "title": "Edit",
          "iconName": "Edit",
          "aria-label": "Edit"
        }
      }
    ]
  }

By including this customRowAction element in your JSON template, you can add the edit button under the action section of your SharePoint list. Customizing the JSON template allows you to create a tailored user experience and enhance the functionality of your list with custom buttons.

Summary

  • Start by creating a customRowAction element in your JSON template.
  • Use the “editProps” property to define the action for the edit button.
  • Use the “defaultClick” property to specify the action for the view button.
  • Customize the JSON template to add the desired buttons under the action section of your SharePoint list.

Table

Button Action
Edit Opens the list view form for editing the selected row.
View Opens the list view form for viewing the selected row.

Implementing the Edit Button

Once you have created the customRowAction element, you need to add a placeholder column to your list or view and use the provided JSON templates to implement the edit button functionality. This will enhance the action options available in your SharePoint list, allowing users to easily edit the items.

To begin, navigate to your SharePoint list or view where you want to add the edit button. Insert a placeholder column, which will serve as the container for the button. This can be done by editing the list settings and creating a new column of the appropriate type.

Next, open the JSON formatting pane by selecting the column header and choosing “Column settings” from the menu. In the formatting pane, locate the customRowActions property and add the JSON template for the edit button. Use the “editProps” action to specify that this button should trigger the edit functionality.

Save your changes and test the implementation by viewing your SharePoint list or view. The edit button will now appear under the action menu for each item. When clicked, the list view form will open, allowing users to make modifications.

Meet the Author

Abdul Rahim has been working in Information Technology for over two decades. Learn how Abdul got his start as a Tech Blogger , and why he decided to start this Software blog. If you want to send Abdul a quick message, then visit his contact page here.