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

how to call enumerateObjectInstances by code

I have panel properties with selector : ISelectionId.getSelector()

 

in my table view i bind event click to define with row is selected by user and show some properties in panel properties using enumerateObjectInstances, the problem are when panel properties active/show and user click some row in table view because enumerateObjectInstances not called by power bi.

 

it any way to call enumeration by code? i need to refresh panel properties depend row selected

1 ACCEPTED SOLUTION

Accepted Solutions
saifulhq Regular Visitor
Regular Visitor

Re: how to call enumerateObjectInstances by code

solve this case use persist object

 

    public syncSelection(ids: ISelectionId[], row: number, col: number, selector: Selector) {
        if (row == null) return;

        
        let enumerationObject: powerbi.VisualObjectInstanceEnumerationObject = {
            containers: [],
            instances: [],
        };
        let persistProperties : VisualObjectInstancesToPersist;

        if(row == -1){ // remove from format panel
            this.settingDataPoint(enumerationObject, "dataPoint");
            persistProperties = {
                remove: enumerationObject.instances
            }
        }
        
        this.selected.row = row;
        this.selected.col = col;
        this.selected.selected = ids[0];
        this.selected.selectionId = ids;
        this.selected.selector = selector;

        if(row != -1) {
            this.settingDataPoint(enumerationObject, "dataPoint");
            persistProperties = {
                replace : enumerationObject.instances
            }
        }
        // console.log('ini coba persist', persistProperties);
        this.host.persistProperties(persistProperties);
    }

but I still don't understand remove and removeObject how to use it, to confused

 

View solution in original post

2 REPLIES 2
saifulhq Regular Visitor
Regular Visitor

Re: how to call enumerateObjectInstances by code

it is imposible to update format panel when user click some row in our view?

 

I try using this.host.refreshHostData(); this solve my problem when developing,

but this not working when we use pbiviz package because enumerateObjectInstances never called

saifulhq Regular Visitor
Regular Visitor

Re: how to call enumerateObjectInstances by code

solve this case use persist object

 

    public syncSelection(ids: ISelectionId[], row: number, col: number, selector: Selector) {
        if (row == null) return;

        
        let enumerationObject: powerbi.VisualObjectInstanceEnumerationObject = {
            containers: [],
            instances: [],
        };
        let persistProperties : VisualObjectInstancesToPersist;

        if(row == -1){ // remove from format panel
            this.settingDataPoint(enumerationObject, "dataPoint");
            persistProperties = {
                remove: enumerationObject.instances
            }
        }
        
        this.selected.row = row;
        this.selected.col = col;
        this.selected.selected = ids[0];
        this.selected.selectionId = ids;
        this.selected.selector = selector;

        if(row != -1) {
            this.settingDataPoint(enumerationObject, "dataPoint");
            persistProperties = {
                replace : enumerationObject.instances
            }
        }
        // console.log('ini coba persist', persistProperties);
        this.host.persistProperties(persistProperties);
    }

but I still don't understand remove and removeObject how to use it, to confused

 

View solution in original post

Helpful resources

Announcements
October 2019 Community Highlights

October 2019 Community Highlights

October was a busy month in the community. Read the recap article to learn about some of the events and content.

New Badges

Incoming: New and Improved Badges

Exciting news: We've given our badges an overhaul and added brand news ones.

Ask Amir Anything

Exclusive LIVE Community Event No. 2 – Ask Amir Anything

Next in our Triple A series: Ask Amir Netz questions about the latest updates, features and future.

Analytics in Azure virtual event

Analytics in Azure virtual event

Experience a limitless analytics service built to ingest, prep, manage, and serve data for immediate use in Power BI.

Users Online
Currently online: 198 members 1,843 guests
Please welcome our newest community members: