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

How to deselect all selected rows in ALL grids?

3 Answers 214 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Adam
Top achievements
Rank 1
Adam asked on 24 Jul 2012, 08:30 AM
Hello,

i have some a grid and every of its rows has a subgrid (NestedViewTemplate).
The option AllowMultiRowEdit is set to "false".
This option let me select only one row per grid (which is ok) but does not prevent to select a single row in each grid/subgrid!
Is there a way to select only 1 row in ALL grids/subgrids together?
I want to have only one selected row, no matter how many subgrids are open.
So if I select a row in a subgrid, the selected row in an other subgrid should be automatically deselected.

Any solution for my request?

By the way, it should be client side only!

Thanks,
Adam

3 Answers, 1 is accepted

Sort by
0
Adam
Top achievements
Rank 1
answered on 24 Jul 2012, 11:22 AM
ok, i got the solution myself.

what i do is on every OnRowSelected-Event i put the ID of the current subgrid in a variable.
if i click an other subgrid I just clear the entire previous subgrid (clearSelectedItems()), so I have never more than one selected row in all the subgrids!

So my problem is solved! :-)
0
Jarkko
Top achievements
Rank 1
answered on 20 Aug 2012, 11:48 AM
Hi, 

I am facing the same problem, but I cannot figure out how your did it without the sources. Could you (or anyone who knows how to do this) provide the client side javascript code that is need in order to accomplish this?

What I currently have is this, but it doesnt work..

<script type="text/javascript">
      var id = "";
      function rowSelected(sender, args) {
      {
          if(id != args.get_id())
          {
             var grid = $find(id);
             grid.clearSelectedItems();
          }
          id = args.get_id();                    
      }    
</script> 



and in the NestedViewTemplate I have: 

<ClientSettings>
                    <Selecting AllowRowSelect="True" CellSelectionMode="None"/>
                    <ClientEvents OnRowSelected="rowSelected" />
</ClientSettings>
0
Eyup
Telerik team
answered on 23 Aug 2012, 07:15 AM
Hello,

Could you please verify that the provided web sites in the following forum thread work as expected?
http://www.telerik.com/community/forums/aspnet-ajax/grid/nested-radgrid-and-selecting-only-one-row-in-the-whole-grid.aspx

If you prefer to use the client-side approach, you could use only the part of the javascript code implemented in the RadGridHierarchyWithNestedViewTemplate application in accordance with your specific scenario.

Kind regards,
Eyup
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Grid
Asked by
Adam
Top achievements
Rank 1
Answers by
Adam
Top achievements
Rank 1
Jarkko
Top achievements
Rank 1
Eyup
Telerik team
Share this question
or