Forum Discussion
PowerBI Javascript API switchMode
- 8 years ago
Hi,
Please take a try with the way below:
You can use the following JavaScript to switch into view mode, if you are in edit mode
```javascript // Switch to view mode. report.switchMode("view"); ```You can use the following JavaScript to switch into edit mode, if you are in view mode
```javascript // Switch to edit mode. report.switchMode("edit"); ```For more configuration code, check:
Regards,
Michael
Hi,
Please take a try with the way below:
You can use the following JavaScript to switch into view mode, if you are in edit mode
```javascript
// Switch to view mode.
report.switchMode("view");
```You can use the following JavaScript to switch into edit mode, if you are in view mode
```javascript
// Switch to edit mode.
report.switchMode("edit");
```For more configuration code, check:
Regards,
Michael
Thanks Michael. This works. The current TypeScript definitions require a models.ViewMode enum value, but if I bypass the TypeScript def and pass in a string as you suggest it works. Looks like the library just needs to be updated so that it sends the string value instead of the numeric value of the enum.