This is a migrated thread and some comments may be shown as answers.

Detect key down on NodeExpand?

2 Answers 50 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Jeppe
Top achievements
Rank 1
Jeppe asked on 08 Sep 2009, 04:21 AM
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 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 08 Sep 2009, 08:10 AM
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.
0
Jeppe
Top achievements
Rank 1
answered on 09 Sep 2009, 03:58 AM
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.
Tags
TreeView
Asked by
Jeppe
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Jeppe
Top achievements
Rank 1
Share this question
or