Forum Discussion
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
- KoBe321Frequent Visitor
We can reproduce the same bug with the following steps:
- go to Edit mode
- download the report
- refresh the page
- go to Edit mode again
- blumi78Helper I
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-viigCommunity 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
- blumi78Helper 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-viigCommunity 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