Forum Discussion

blumi78's avatar
blumi78
Helper I
8 years ago

Visual.update() not triggered when switching from Reading to Edit View

When switching from Edit to Reading View, Visual.update(options) is triggered and options.viewMode is set to 0.

Vice versa, when switching back to Edit View, Visual.update() ist NOT triggered and therefore I can not react to this event.

In the upcoming calls to Visual.update (like on data change or resizing), options.viewMode is 1 as expected.

 

Related, the typedef of ViewMode is

const enum ViewMode {
    View = 0,
    Edit = 1,
    InFocusEdit = 2,
}

- but value 2 never occured in my occasions. What is "InFocusedEdit"?

13 Replies

  • KoBe321's avatar
    KoBe321
    Frequent Visitor

    We can reproduce the same bug with the following steps:

    1. go to Edit mode
    2. download the report
    3. refresh the page
    4. go to Edit mode again
  • already posted this in the "Service" board, but maybe it belongs here also:

     

    When switching from Edit to Reading View, Visual.update(options) is triggered and options.viewMode is set to 0.

    Vice versa, when switching back to Edit View, Visual.update() ist NOT triggered and therefore I can not react to this event.

    In the upcoming calls to Visual.update (like on data change or resizing), options.viewMode is 1 as expected.

     

    Related, the typedef of ViewMode is

    const enum ViewMode {
        View = 0,
        Edit = 1,
        InFocusEdit = 2,
    }

    - but value 2 never occured in my occasions. What is "InFocusedEdit"?

  • v-viig's avatar
    v-viig
    Community Champion

    It works well on my side with Dot Plot custom visual. Can you share code of update method?

     

    InFocusEdit is an focus mode that can be activated by opening ... menu in the right top corner of a csutom visual.

    Then you should select Edit. Please note a csutom visual must specify advancedEditModeSupport: true in the capabilities to support Focus Edit Mode.

     

    Ignat Vilesov,

    Software Engineer

     

    Microsoft Power BI Custom Visuals

    [email protected]

    • blumi78's avatar
      blumi78
      Helper I

       

      Just create a new Custom Visual:

      > pbiviz new example

       

      then change the update() function to display the viewMode and editMode flags:

      public update(options: VisualUpdateOptions) {
          if (typeof this.textNode !== "undefined") {
              this.textNode.textContent = "ViewMode: " + options.viewMode.toString() + ", EditMode: " + options.editMode;
          }
      }

      And insert this into capabilities:

          "advancedEditModeSupport": 2,

       

      Results:

      Directly after loadSwitching to EditAfter resizing visual in Edit ModeSwitching to Advanced Edit ModeGoing back to Reading view

      As you can see, Switching to edit mode does not change the ViewMode (or EditMode), it needs the second update (data or resize update). And viewMode never gets value 2.

       

      • v-viig's avatar
        v-viig
        Community Champion

        Have you filled all of required data fields?

        I guess this is a root case of the issue.

         

         

        Ignat Vilesov,

        Software Engineer

         

        Microsoft Power BI Custom Visuals

        [email protected]