Forum Discussion
Custom visuals ItemFlagsSelection formatting settings
- Anonymous2 years ago
Hello Vil , Anonymous , EscritórioDados , dm-p , PowerBI custom visuals developer is here.
This reply is edited.
There are 2 components to work with flags - ItemFlagsSelection and AutoFlagsSelection. AutoFlagsSelection needs you only to specify default value and enumeration values in capabilities.json. ItemFlagsSelection needs you to specify enumeration values in formatting settings card, but in capabilities.json you may just leave empty array.
But it seems that there's a bug with ItemFlagsSelection. It gives correct value in dataView, but does not display which flags are enabled, instead it resets all of them as if nothing is checked. On contrary AutoFlagsSelection works as expected, so I suggest you to use it. Here's public repo with simple example how to use AutoFlagsSelection.
Also, I'll provide necessary steps below.
1. Specify enumeration values in capabilities.json
2. Create AutoFlagsSelection slice with default value. I'm using defaut value as empty string so no flags are checked.
3. Get the value from formattingSettings. It's represented as Number and each bit corresponds to the single flag. If the number is equal to zero, then no flags are enabled. It's a good practice to use TypeScript enums and check values that are comming from PowerBI.
I has use the steps that Anonymous post, didn't work correctly.
The checkbox was unchecked automatically after I have click in it.
I try a lot of thechnics to maintain the item state, using update method. Nothing works.
I would like to see one full example with only the ItemFlagsSelection in a card on formatting pane. Parts of codes doesn't resolve the trouble, because never works when I put into files of project on VSCode and test in app.powebi.com.
Is difficul to do this?
- Anonymous2 years agoNot applicable
Hello EscritórioDados Vil , here’s public repo where you can see how to work with AutoFlagsSelection.
After tinkering with ItemFlagsSelection I think that there’s a bug with TypeScript definition of ItemFlagsSelection and another bug how it’s displayed in formatting pane.What I mean is that the value is passed into dataView successfully, but it’s not displayed in formatting pane. Instead all flags/checkbox items in formatting pane are reset.This does not happen with AutoFlagsSelection. Please try the example and provide a feedback.