Forum Discussion
satishr
Helper III
8 years agoRevert to default option doesn't work in my custom visual
I have developed a simple custom visual following the documentation available. I have created few format options in the capabilities.ts file and have assigned values to them in visual.ts using variab...
- 8 years ago
You use single variable to keep the default value and current value.
That means, you should move default values to new variables and use them if and only if the property is undefined in metadata.
this.kpiName = options.dataViews[0].metadata.objects["kpiName"] && options.dataViews[0].metadata.objects["kpiName"]["name"] ? this.kpiName = options.dataViews[0].metadata.objects["kpiName"]["name"].toString() : "KPI Name";Ignat Vilesov,
Software Engineer
Microsoft Power BI Custom Visuals
v-viig
Community Champion
8 years agoYou use single variable to keep the default value and current value.
That means, you should move default values to new variables and use them if and only if the property is undefined in metadata.
this.kpiName = options.dataViews[0].metadata.objects["kpiName"] && options.dataViews[0].metadata.objects["kpiName"]["name"]
? this.kpiName = options.dataViews[0].metadata.objects["kpiName"]["name"].toString()
: "KPI Name";Ignat Vilesov,
Software Engineer
Microsoft Power BI Custom Visuals