Skip to content

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

@dborchers-gc

Description

@dborchers-gc

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
  • 💥 Microsoft Edge
  • 💥 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:list-formattingCategory: View, row & column formatting with JSONtype:archive-old-issueIssues which are closed as tool old for active worktype:bug-suspectedSuspected bug (not working as designed/expected). See “type:bug-confirmed” for confirmed bugs.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions