cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Cubist Regular Visitor
Regular Visitor

Is this how update and persistProperties are supposed to work?


In what ways do update and persistProperties affect or trigger each other?  

[custom visual question] 


 Two specific questions are:

 

1)  Is this assumption correct?

Calling persistProperties triggers and update event, and from within the triggered event handler, calling VisualSettings.parse should always return results that include the new property value set during the perist call. 

 

This seems like what is supposed to happen, however I notice in some cases the actual behaviour is different or odd/unusual.  It seems either my understanding is incorrect, or there are exceptions where this does not happen.

 

2)  What is the expected behaviour of merge and replace for the persistProperties method? 

For example, these points are not clear:

  • When a property already exists: How is merge different from replace?  If the prop exists, does merge act identically and replace the property, or ignore it?
  • What a property does not exist:  How is merge different from replace?  If the prop does not exist, do they act identically and simply save the new property?

Any comments are appreciated, thank you.

 

3 REPLIES 3
Moderator v-viig
Moderator

Re: Is this how update and persistProperties are supposed to work?

Hello @Cubist,

 

  1. Yes, you're correct. Calling persistProperties always triggers the update method. The argument of update method contains the up dated value that has been set by using persistProperties. What for do you use persistProperties?
  2. The merge operation merges the existing properties and the new properties. The replace operation removes the existing properies and saves the new properties. If properties don't exist persistProperties just saves the new properties.

 

Please let me know if you any further questions.

 

Ignat Vilesov,

Software Engineer

 

Microsoft Power BI Custom Visuals

pbicvsupport@microsoft.com

Cubist Regular Visitor
Regular Visitor

Re: Is this how update and persistProperties are supposed to work?

Thank you, I will mark you answer correct.  One more question please:

 

>>What for do you use persistProperties?

 

Because I have an input field on the visual, that the user can type directly into.  When the user types a value into an input field on my visual, isn't this the only way to save the value?

 

Thank you -

Moderator v-viig
Moderator

Re: Is this how update and persistProperties are supposed to work?

@Cubist

 

There's no another way to keep users' input in such cases.

You should use persistProperties.

 

Ignat Vilesov,

Software Engineer

 

Microsoft Power BI Custom Visuals

pbicvsupport@microsoft.com