Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Data Days is here! Join us now for 60+ days of learning, challenges, and connection. Learn more

Reply
bibble235
Frequent Visitor

RaiseCustomEvent

How do I raise a custom event within a custom visual which will be picked up by the reportContainer. This seems to happen by "magic" when using the categorical dataViewMappings however when using table.

 

    "dataViewMappings": [
        {
        "table": {
                "rows": {
					"select": [{
                    "for": { "in": "Values" }
					}],
                    "dataReductionAlgorithm": { "top": { "count": 30000000 } }
                },
                "rowCount": { "preferred": { "min": 1 } }
            }
        }
    ]

no event is fired.

 

I have tried using the table template but this does not seem work. I cannot get it to display a two dimensional array. E.g. a spreadsheet.

 

Thanks,

3 REPLIES 3
v-chuncz-msft
Community Support
Community Support

@bibble235,

 

Based on my experience, you can use addEventListener() method. As for the layout, just play with HTML and CSS.

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Managed to raise a custom event but this is still not picked up by the report.on function within the iframe. I have tried the table template which uses the categorical DataViewMappings but this does not show the data in the manner I need.

 

All I want is to click on a row and have the report.on function be notified.

 

excel.png

 

Not sure why this seems to be so hard but is the simplist way of showing data.

 

                report.on('dataSelected', event => {
                    debugger;
                    return;
                });

Next attempt consisted of in the click

 

		let myEventData = [];
		myEventData[0] = this.innerHTML;
		let myHTMLElement = this;
		raiseCustomEvent(myHTMLElement,"dataSelected",myEventData);
		console.log(this.innerHTML);

Wondering if I should try WindowPostMessageProxy. I guess it is my lack of knowledge of the product but this seems really hard to do something which looks quite simple. Thanks for taking the time to reply.

 

 

@bibble235,

 

There are a few limitations to using Power BI JavaScript API as well, just leave a comment on GitHub.

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Kudoed Authors