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

RowSelected and Shift Click (multi-selection)

2 Answers 42 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Brian Azzi
Top achievements
Rank 2
Brian Azzi asked on 04 May 2010, 10:09 PM
Ok, here's my problem (and I'm hoping that some of you grid guru's out there can help). I have a grid that performs some semi intensive calculations in the RowSelected event. This is fine for user clicked events & doesn't cause a performance issue. Where I run into trouble is when the user uses a shift click operation to select many rows (which is also valid). In this case I really only want to perform the action on the last row selected (the shift click target).

BUT... the RowSelected event fires once for every single row that becomes selected (which I suppose makes sense). Is there anyway to detect that the shift key was down on this / turn off / detect this type of row selection? It seems to cause a lot of unnecessary spinning of the wheels for me...

Thanks in advance!
-Brian

2 Answers, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 1
answered on 05 May 2010, 09:07 AM
Hello Brian,

You can use the following code inside RowSelecting event in order to detect whether shift key is pressed or not.

Java Script:
<script type="text/javascript"
 function RowSelecting(sender, eventArgs) { 
   if (eventArgs.get_domEvent().shiftKey) 
    { 
       alert("shiftKey is pressed"); 
       //your code 
    } 
   else 
       alert("shiftKey is not pressed"); 
</script> 

Regards,
Shinu.


0
Brian Azzi
Top achievements
Rank 2
answered on 05 May 2010, 02:47 PM
Excellent tip, thank you very much... its nice when what you are looking for is an easy solution for once. ; )  
Tags
Grid
Asked by
Brian Azzi
Top achievements
Rank 2
Answers by
Shinu
Top achievements
Rank 1
Brian Azzi
Top achievements
Rank 2
Share this question
or