Reply
Frequent Visitor
Posts: 6
Registered: ‎03-15-2017
Accepted Solution

Custom Object Drowdown

I'm creating a custom visual. I want to include a dropdown object on the format pane that I can fill with options. I know it's possible because it's in the standard KPI visual, but I can't find any documentation besides primitive types and fills. Any help on how to construct the capabilities.json and enumeration?

 

Thanks!


Accepted Solutions
Super Contributor
Posts: 982
Registered: ‎07-09-2016

All Replies
Super Contributor
Posts: 982
Registered: ‎07-09-2016

Re: Custom Object Drowdown

Frequent Visitor
Posts: 6
Registered: ‎03-15-2017

Re: Custom Object Drowdown

Awesome thanks! That's a great resource.

 

I'll put the code here for others to see an example.

 

Capabilities.json:

"displayUnits": {
                    "displayName": "Display Units",
                    "type": {
                        "enumeration": [{
                            "value": "none",
                            "displayName": "None"
                        }, {
                            "value": "thousands",
                            "displayName": "Thousands"
                        }, {
                            "value": "millions",
                            "displayName": "Millions"
                        }, {
                            "value": "billions",
                            "displayName": "Billions"
                        }]
                    }
                }

And the enumeration is the same as you would get a string.

Frequent Visitor
Posts: 13
Registered: ‎03-16-2017

Re: Custom Object Drowdown

Can you put up enumeration code as well, I tried and it is not working properly

Highlighted
Super Contributor
Posts: 982
Registered: ‎07-09-2016

Re: Custom Object Drowdown

@rgodfrey,

 

If your problem has been resolved, please help mark answer. Your contribution is highly appreciated.

Frequent Visitor
Posts: 6
Registered: ‎03-15-2017

Re: Custom Object Drowdown

It's just like any string:

 

public enumerateObjectInstances(options: EnumerateVisualObjectInstancesOptions): VisualObjectInstanceEnumeration {
    let objectName = options.objectName;
    let objectEnumeration: VisualObjectInstance[] = [];

    switch(objectName) {
        case 'kpi': 
            objectEnumeration.push({
                objectName: objectName,
                properties: {
                    displayUnits: this.kpiSettings.kpi.displayUnits
                },
                selector: null
            });
            break;
    };

    return objectEnumeration;
}