List-Formatting icon indicating copy to clipboard operation
List-Formatting copied to clipboard

Pop up confirmation?

Open sympmarc opened this issue 2 years ago • 2 comments

Question (the more details, the better)

Is it possible to pop up a sort of "Are you sure?" dialog when a user clicks on a formatted column which uses setValue?

sympmarc avatar Aug 28 '23 21:08 sympmarc

Dear Mr. @sympmarc

Thank you for your question, This is a Yes/No answer, below my answer

1- Yes, It's possible to pop up a sort of "Are you sure?" - Below sample explain how to achieve this, please replace the column field "Title" with associated field name. 2- No, is the fact that you cannot remove a out of the box behavior that could impact the expected output of your request. - When you click twice on row will open/redirect to edit properties options and look and feel could appear different. - For this would like to invite to provide your feedback on the following list request that could help manage this type of situations. https://feedbackportal.microsoft.com/feedback/idea/40552001-9b32-ee11-a81c-6045bd8534ad

Thank you for your attention on this subject.

{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
  "elmType": "div",
  "children": [
    {
      "elmType": "div",
      "style": {
        "border": "2px solid #c8c6c4",
        "padding": "10px",
        "border-radius": "5px",
        "cursor": "pointer"
      },
      "txtContent": "='Click me!!' + @currentField",
      "customCardProps": {
        "openOnEvent": "hover",
        "isBeakVisible": true,
        "formatter": {
          "elmType": "div",
          "style": {
            "padding": "10px 0 0 0"
          },
          "children": [
            {
              "elmType": "div",
              "style": {
                "cursor": "pointer",
                "display": "table"
              },
              "attributes": {
                "class": " ms-fontColor-themePrimary"
              },
              "children": [
                {
                  "elmType": "div",
                  "style": {
                    "text-align": "center",
                    "line-height": "normal",
                    "font-size": "24px",
                    "padding": "5px"
                  },
                  "txtContent": "Are you sure?"
                },
                {
                  "elmType": "div",
                  "float": "left",
                  "children": [
                    {
                      "elmType": "div",
                      "style": {
                        "text-align": "center",
                        "display": "inline-block",
                        "width": "100px",
                        "border-top": "2px solid #c8c6c4"
                      },
                      "attributes": {
                        "class": "ms-fontSize-14"
                      },
                      "txtContent": "Yes",
                      "customRowAction": {
                        "action": "setValue",
                        "actionInput": {
                          "Title": "Yes"
                        }
                      }
                    },
                    {
                      "elmType": "div",
                      "style": {
                        "text-align": "center",
                        "display": "inline-block",
                        "width": "100px",
                        "border-top": "2px solid #c8c6c4",
                        "border-left": "2px solid #c8c6c4"
                      },
                      "attributes": {
                        "class": "ms-fontSize-14"
                      },
                      "txtContent": "No",
                      "customRowAction": {
                        "action": "setValue",
                        "actionInput": {
                          "Title": "No"
                        }
                      }
                    }
                  ]
                }
              ]
            }
          ]
        }
      }
    }
  ]
}

aaclage avatar Aug 29 '23 07:08 aaclage

Thank you, @aaclage! I figured if it was possible, there might be an existing sample, but I couldn't find one. I'll try it out and report back.

sympmarc avatar Aug 29 '23 13:08 sympmarc