Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
660
How to trap key events in web tree
posted

I am needing to trap the key events like pressing enter, or arrow keys etc. for the tree.  Any code samples for this?

 

Thanks.

 

  • 7694
    posted

     Hello,
    You can use client side event KeyDown. Please take a look at the code code below:

    <ClientSideEvents KeyDown="Fire" />

    <script type="text/javascript">
            function Fire(treeId, keyID) {
                if (keyID == 13) {
                    // ENTER
                }
                if (keyID == 40) {
                    // Down arrow
                }
                if (keyID == 39) {
                    // Right arrow
                }
                if (keyID == 38) {
                    // Up arrow
                }
                if (keyID == 37) {
                    // Left arrow
                }

            }</script>


    Hope this helps.