Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
WouterBo
Helper II
Helper II

Can I edit a user's input and write it back to the formatting pane?

Hello,

 

Does anyone know if it is possible to edit or remove a user's input into the formatting pane and write it back to the formatting pane? 

 

Suppose I added an option to the formatting pane in capabilities.ts like so:

 

 

 

"objects": {
        "myOptions": {
            "displayName": "Options",
            "displayNameKey": "Visual_Options",
            "properties": {
                "name": {
                    "displayName": "Name",
                    "displayNameKey": "Visual_Name",
                    "type": {
                        "text": true
                    }
                }
           }
        },

 

 

 

When update(options) is called, I can use the DataViewObjectsParser.parse() function on the dataView to extract whatever the user has entered there. 

 

But can I edit what the user entered and write it back to the formatting pane? So that the next call to update() yields the edited value?

 

Thank you! 

 

 

5 REPLIES 5
v-shex-msft
Community Support
Community Support

Hi @WouterBo,

Did dm-p 's suggestions help with your scenario? if that is the case, you can consider Kudo or accept his suggestion to help others who faced similar requirements to find it more quickly.

If these also not help, please share more detailed information to help us clarify your scenario to test.

How to Get Your Question Answered Quickly 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
dm-p
Super User
Super User

Hi @WouterBo

If you're looking to update a property within your visual and see this change reflected in the pane, you can use IVisualHost.persistProperties() to and supply the changes you wish to merge into the dataView. Calling this will cause your visual to trigger an update() and re-enumerate the properties, so any changes can be seen in the corresponding property in the pane.

This will allow you to set the property value from either within your visual, or from the pane, so if you only want the property to be set within the visual and not be shown in the pane, you can remove it from the instance, or not push it in, depending on how you're enumeration code is implemented (I personally use the former). This way you can still set and read it within your visual but clears up any potential amgiguity for your end user.

Regards,

Daniel





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!


My course: Introduction to Developing Power BI Visuals


On how to ask a technical question, if you really want an answer (courtesy of SQLBI)




Hi Daniel,

 

Thanks for your insights.

The use case here was to give the user a toggle (boolean) in the properties panel that could be used to clear a license key that was entered before. So, when setting the toggle to 'true' the visual should clear the license key and set the toggle back to 'false'. I found that upon each update() the DataView would contain the data entered by the user. Naturally I can manipulate the values entered, but it lead to a chicken-egg problem. I considered using persistProperties() but the user's input would still be there on each update().

I worked around it by using the 'revert to default' as a reset 'button' which does what we wanted in this case.
But permanently overwriting what a user has entered isn't really possible I think.

Thanks for thinking along though. Much appreciated!

v-shex-msft
Community Support
Community Support

Hi @WouterBo,

I'm not so sure why you want to achieve this effect. Maybe you can try to add a global variable to store the inputted values and interact with update functions.

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Hi Xiaoxin,

 

I've already programmed a workaround which has been deemed acceptable. But am I right in assuming that the settings are read only?

 

Thanks!

Wouter

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.