Detect key down on NodeExpand?

3 posts, 0 answers
  1. Jeppe
    Jeppe avatar
    12 posts
    Member since:
    Jan 2009

    Posted 07 Sep 2009 Link to this post

    Hi

    I would like to detect a key down when i press a node expand in my tree view. In this way I can decide to expand all nodes on a tree if for example the Shift key is hold down why pressing the expand.

    Jeppe
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 08 Sep 2009 Link to this post

    Hi Jeppe,

    Checkout the following client side code which shows how to check whether Shift key is pressed when expanding the node using keyboard.

    javascript:
     
    <script type="text/javascript"
    function OnClientNodeExpanding(sender, args) 
        alert('KeyCode is :'+args.get_domEvent().keyCode); 
        if(args.get_domEvent().shiftKey
        { 
            alert("shiftKey is pressed"); 
        } 
    </script> 

    -Shinu.
  3. Jeppe
    Jeppe avatar
    12 posts
    Member since:
    Jan 2009

    Posted 08 Sep 2009 Link to this post

    Thanks for the answer.

    I am not sure how I can use that server side to call a ExpandAllNodes function?

    Anyway I solved it by adding a context menu item to the nodes instead. So to expand only current node press the the +, else right click and expand all.
Back to Top