Forum Discussion

lucmax's avatar
lucmax
Helper II
6 years ago
Solved

Apply JSON Filter to own custom visual

Hey,   I'm trying to build a new version of our custom visual because I saw other custom visuals (apparently) applying json filters to themself. How can I achive this behaviour and apply a json fil...
  • lucmax's avatar
    6 years ago

    With help of a fellow forum member I got it to work the way I want. You need to do the following to have your visual filter itself AND others visuals:

     

    capabilities.json (general)

     

                "properties": {
                    "filter": {
                        "type": {
                            "filter": true
                        }
                    },
                    "selfFilter": {
                        "type": {
                           "filter": {
                              "selfFilter": true
                           }
                        }
                     }
                }

     

    ApplyJsonFilter call(s)

        this._visualHost.applyJsonFilter(
          filterList,
          "general",
          "selfFilter",
          powerbi.FilterAction.merge
        );
        this._visualHost.applyJsonFilter(
          filterList,
          "general",
          "filter",
          powerbi.FilterAction.merge
        );

     

    Hope this helps someone else!