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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
ysapiyev
Responsive Resident
Responsive Resident

Multiple selection in custom visual

Hi everyone.

 

I wanted to know, how to do multple selection using pressed CTRL button and mouse click, instead of mouse click. I set

this.selectionManager.select(d.identity, true), and it selects multiple data, but just by mouse click. How to alter it for identification of CTRL button pressed?
1 ACCEPTED SOLUTION
v-viig
Community Champion
Community Champion

Hello @ysapiyev,

 

You should use something like this (event documentation😞

 

// event is a mouse event

const isCtrlKeyPressed = event.ctrlKey;

this.selectionManager.select(d.identity, isCtrlKeyPressed);

Ignat Vilesov,

Software Engineer

 

Microsoft Power BI Custom Visuals

pbicvsupport@microsoft.com

 

View solution in original post

6 REPLIES 6
v-viig
Community Champion
Community Champion

Hello @ysapiyev,

 

You should use something like this (event documentation😞

 

// event is a mouse event

const isCtrlKeyPressed = event.ctrlKey;

this.selectionManager.select(d.identity, isCtrlKeyPressed);

Ignat Vilesov,

Software Engineer

 

Microsoft Power BI Custom Visuals

pbicvsupport@microsoft.com

 

ysapiyev
Responsive Resident
Responsive Resident

Hello  @v-viig,

 

Could you have a look at my problem?

 

Regards

Yerkhan

v-viig
Community Champion
Community Champion

That code snippet looks good.

Can you share the whole source code for debugging?

 

Ignat Vilesov,

Software Engineer

 

Microsoft Power BI Custom Visuals

pbicvsupport@microsoft.com

ysapiyev
Responsive Resident
Responsive Resident

@v-viig,

 

Yes, should I send you visual.ts? And please share your email.

 

Regards,

Yerkhan

v-viig
Community Champion
Community Champion

It'd be better to share all of files.

You can send all of them to pbicvsupport@microsoft.com.

 

 

Ignat Vilesov,

Software Engineer

 

Microsoft Power BI Custom Visuals

pbicvsupport@microsoft.com

ysapiyev
Responsive Resident
Responsive Resident

Hello @v-viig,

 

So ,as I understood, it should look like this, right?

var event =  <Event>d3.event;
const isCtrlKeyPressed =event.ctrlKey;

this.selectionManager.select(d.identity, isCtrlKeyPressed);

However, it shows me that there is no property ctrlKey in event. I googled, and it gives me similar solution as yours. What can be wrong?

 

Regards,

Yerkhan

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.