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

Client-side multi row select - detect last selection

2 Answers 56 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Marcel
Top achievements
Rank 1
Marcel asked on 02 Mar 2011, 09:35 PM
Hello,

I am using the client-side API and use AllowMultiRowSelection="True". I need to rebind a second control when a grid row is selected or deselected. My problem is that using the shift key or the checkbox at the top of the grid, many or all rows can be selected at once and each (correctly) fires the RowSelected event, causing many rebinds of the second control.

 

I only want to fire the rebind once per user action. Any suggestion is appreciated.

2 Answers, 1 is accepted

Sort by
0
Vasil
Telerik team
answered on 08 Mar 2011, 11:53 AM
Hi Macrel,

There is no event that is called after the selection is complete, but you can use the code bellow to achieve it:

var lastSelected = null;
var extraSelected = true;
var timerStarted = false;
 
function timedCheck() {
 
  if (extraSelected) {
    extraSelected = false;
    setTimeout("timedCheck()", 25);
  }
  else {
    timerStarted = false;
    MyFunc(LastSelected);
  }
}
 
function MyFunc(lastSelectedIndex) {
  //Rebind your grid here
}
 
function RowSelected(sender, args) {
  LastSelected = args.get_itemIndexHierarchical();
  extraSelected = true;
 
  if (!timerStarted) {
    timerStarted = true;
    setTimeout("timedCheck()", 25);
  }
}

Regards,
Vasil
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
Marcel
Top achievements
Rank 1
answered on 17 Mar 2011, 11:23 PM
Hi Vasil,

That worked perfectly. Thank you.
Tags
Grid
Asked by
Marcel
Top achievements
Rank 1
Answers by
Vasil
Telerik team
Marcel
Top achievements
Rank 1
Share this question
or