Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pop up confirmation? #706

Open
sympmarc opened this issue Aug 28, 2023 · 2 comments
Open

Pop up confirmation? #706

sympmarc opened this issue Aug 28, 2023 · 2 comments
Labels
❓ Question Question about one of the samples

Comments

@sympmarc
Copy link

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 sympmarc added the ❓ Question Question about one of the samples label Aug 28, 2023
@aaclage
Copy link
Contributor

aaclage commented Aug 29, 2023

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"
                        }
                      }
                    }
                  ]
                }
              ]
            }
          ]
        }
      }
    }
  ]
}

@sympmarc
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
❓ Question Question about one of the samples
Projects
None yet
Development

No branches or pull requests

2 participants