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

Programmatic selection of grid rows - performance issues

1 Answer 124 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
Rob asked on 11 Nov 2008, 11:46 AM
Hi there,

I'm having performance problems with some client-side code that programmatically selects rows in my grid. The grid has 20 columns of varying type - template columns and bound columns. There's also a checkbox column as my grid is multi-select enabled.

Above my grid I've put a series of span elements with an onclick handler that allow the user to quickly select rows in the grid with a single click:

Select all  |  Deselect all  |  Select payables  |  Select receivables

Here's the code I use to do the selection:

// Pick up the grid's master table  
var masterTable = $find("<%= grdResults.ClientID %>").get_masterTableView();    
// Loop through the grid's items  
for(var i=0;i<masterTable.get_dataItems().length;i++)    

This does work, but if I have over 50 rows in my grid then it starts to run slowly, and if I have 100 rows in the grid I get the Internet Explorer dialog that warns that a script is running slowly.

There is code in the grid row selecting, selected, and deselected client-side events, but I set a flag at runtime indicating that I'm selecting rows programmatically so that the event handlers return without doing anything while the programmatic selection takes place.

So, two questions...

1. Is there a way of speeding up the programmatic selection any more?

2. If not then is there a way of displaying a loading panel using only client-side code, no postbacks?

Many thanks in advance,

1 Answer, 1 is accepted

Sort by
Nikolay Rusev
Telerik team
answered on 14 Nov 2008, 07:49 AM
Hello Rob,

You can use clearSelectedItems for deselecting all items or selectAllItems() to select all data items in a current GridTableView. Both functions works faster then the approach you use.

Regarding your second question - the link below illustrates how to explicitly show/hide the RadLoadingPanel:
Show and hide loading panel explicitly

I hope this helps.

Kind regards,
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Asked by
Top achievements
Rank 1
Answers by
Nikolay Rusev
Telerik team
Share this question