Forum Discussion

az2451's avatar
az2451
Resolver I
8 years ago
Solved

Support of (d3) Key Events?

Im trying to add a keyEvent because i want to submit only when i press enter

 

But it doesnt seem to exist here for powerbi.

 

Are there any alternatives or is it just disabled for security reasons?

 

 d3.select(this.helpLinkElement9[3]).on("keypress", function(){

                if(d3.event.keyCode === 32 || d3.event.keyCode === 13){
                    console.log("Congrats, you pressed enter or space!")
                    }

                ...

 

 

  • I figured it out by just playing with the code :)

     

    This works for me, if someone faces the same issue:

     

    d3.select(this.helpLinkElement9[3]).on("keypress", function(){
    
        if((event as KeyboardEvent).keyCode === 13){
                       
            /* Code */
    
        }
    
            
    });

3 Replies

  • I figured it out by just playing with the code :)

     

    This works for me, if someone faces the same issue:

     

    d3.select(this.helpLinkElement9[3]).on("keypress", function(){
    
        if((event as KeyboardEvent).keyCode === 13){
                       
            /* Code */
    
        }
    
            
    });
  • v-viig's avatar
    v-viig
    Community Champion

    What exactly issue are you facing? Are there any build issues?

     

    Ignat Vilesov,

    Software Engineer

     

    Microsoft Power BI Custom Visuals

    [email protected]

    • az2451's avatar
      az2451
      Resolver I

      It says "keyCode" is not available for type "Event"