Forum Discussion
persistProperties no longer persists unless property is changed via Formatting Pane
- 7 months ago
Hi alexpokerface,
What value are you using for selector in the persist operation? I used to use undefined prior to moving to the formatting model, but I was having the same issues and had to change this to be explcitly null to persist correctly. This is technically the correct syntax for the data view if a property is unbound, and I suspect that the enumerateObjectInstances() method was a bit more forgiving.
Depending on your TS configuration, you may need to cast to keep the compiler happy, e.g.:
{ replace: [ { objectName: "myObject", selector: null as unknown as powerbi.data.Selector, properties: { // Property value(s) } } ] }Hopefully this helps. Good luck!
Daniel
Hi alexpokerface,
What value are you using for selector in the persist operation? I used to use undefined prior to moving to the formatting model, but I was having the same issues and had to change this to be explcitly null to persist correctly. This is technically the correct syntax for the data view if a property is unbound, and I suspect that the enumerateObjectInstances() method was a bit more forgiving.
Depending on your TS configuration, you may need to cast to keep the compiler happy, e.g.:
{
replace: [
{
objectName: "myObject",
selector: null as unknown as powerbi.data.Selector,
properties: {
// Property value(s)
}
}
]
}
Hopefully this helps. Good luck!
Daniel
- alexpokerface7 months agoFrequent Visitor
Hi dm-p ,
Thanks a lot for your suggestion! The selector was indeed the problem. I used {} instead of null or undefined in some cases. For me now it works with both null as well as undefined.
I remember I couldn't get it to work with undefined or null before and had to use {} instead. But I have tried a lot since then, including changing the data type of the data to persist from numeric to string. That in combination with the undefined selector seems to work now.
Thanks again and kind regards,
Alex