sp-dev-docs icon indicating copy to clipboard operation
sp-dev-docs copied to clipboard

openContextMenu doesnt seems to work in sp/formatting Schema (v2)

Open dborchers-gc opened this issue 3 years ago • 4 comments

Target SharePoint environment

SharePoint Online

What SharePoint development model, framework, SDK or API is this about?

Declarative list formatting

Developer environment

No response

What browser(s) / client(s) have you tested

  • [ ] 💥 Internet Explorer
  • [X] 💥 Microsoft Edge
  • [X] 💥 Google Chrome
  • [ ] 💥 FireFox
  • [ ] 💥 Safari
  • [ ] mobile (iOS/iPadOS)
  • [ ] mobile (Android)
  • [ ] not applicable
  • [ ] other (enter in the "Additional environment details" area below)

Additional environment details

No response

Describe the bug / error

I would like to create a row/view Formatting for a document library without an active selection (hideSelection: true)

In the current schema it seems to be possible to create a button and setup the customRowAction to openContextMenu so it should open the Context menu when i click on this button.

https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json

I´ve tried it but nothing happens when i click on the Button

Here is my Code:

{
    "schema": "https://developer.microsoft.com/json-schemas/sp/v2/row-formatting.schema.json",
    "debugMode": true,
    "hideSelection": true,
    "hideColumnHeader": true,
    "rowFormatter": {
      "elmType": "div",
      "attributes": {
        "class": "ms-borderColor-neutralLight"
      },
      "style": {
        "box-sizing": "border-box",
        "background-color": "=if( ([$Applikationen.lookupValue] == '') && ([$Instanzen.lookupValue] == '') && ([$Schnittstellen.lookupValue] == '') && ([$Prozesse.lookupValue] == '') && ([$Datenbanken.lookupValue] == '') && ([$ContentTypeId] != '0x01200067C268F3F5C81C4FA7BF5701AB710604'), 'rgba(219, 85, 85, 0.5)', '#fff')",
        "width": "100%",
        "border-width": "1px",
        "border-style": "solid",
        "padding": "0 0 0 20px",
        "margin-bottom": "10px",
        "align-items": "stretch"
      },
      "children": [
...
           {
              "elmType": "div",
              "style": {
                "flex": "0 0 170px",
                "display": "=if( ([$ContentTypeId] != '0x01200067C268F3F5C81C4FA7BF5701AB710604'), 'flex', 'none')",
                "flex-direction": "column"
              },
              "children": [
                {
                  "elmType": "button",
                  "customRowAction": {
                    "action": "editProps"
                  },
                  "txtContent": "Eigenschaften bearbeiten",
                  "attributes": {
                    "class": "sp-row-button ms-bgColor-neutralLighter ms-fontWeight-semibold"
                  },
                  "style": {
                    "width": "145px",
                    "height": "48px",
                    "margin": "20px 0 10px 0"
                  }
                },
                {
                    "elmType": "button",
                    "customRowAction": {
                      "action": "openContextMenu"
                    },
                    "txtContent": "Kontextmenü",
                    "attributes": {
                      "class": "sp-row-button ms-bgColor-neutralLighter ms-fontWeight-semibold"
                    },
                    "style": {
                      "width": "145px",
                      "height": "48px",
                      "margin": "20px 0 10px 0"
                    }
                  }
              ]
            }
...

the ozher options like editProps work good

When i disable hideSelection then it works but then the ContextMenu works everywhere and i dont really need a button for that. I dont think that's the expected heavior for this setting.

Steps to reproduce

Setup Row Formatting Click on the Button

Expected behavior

Open the Context Menu

dborchers-gc avatar Mar 08 '22 10:03 dborchers-gc

Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.

ghost avatar Mar 08 '22 10:03 ghost

FYI @shagra-ms

dborchers-gc avatar Mar 08 '22 10:03 dborchers-gc

Unfortunately, this is still an issue one year on. It would be great to get this custom action working.

hughmcmaster avatar Mar 13 '23 04:03 hughmcmaster

Still an issue. Any update?

MissHerku avatar Sep 26 '24 14:09 MissHerku

Thank you for taking the time to file an issue. We periodically archive older or inactive issues as part of our issue management process, which automatically closes them once they are archived.

If you’d like to understand more about why and how we handle archived (closed) issues, please see Our approach to closed issues.

We appreciate your contribution and if this is still an active issue with the latest SPFx versions, please do resubmit the details. We needed to perform a cleanup, so that we can start with a clean table with a new process. We apologize for the inconvenience this might cause.

github-actions[bot] avatar May 02 '25 15:05 github-actions[bot]