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

Only One Row Selection in Master Table and Multiple rows Selection in Details Table

1 Answer 140 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Venkata
Top achievements
Rank 1
Venkata asked on 04 Feb 2014, 09:36 PM
Hi,
I have a grid with detail table.
I want to allow only one row selection on Master Table.
But I want to allow multi row selection on Detail Table.

How can i do in Javascript.?

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 05 Feb 2014, 11:19 AM
Hi Venkata,

Please try the following code snippet to achieve your required scenario:

ASPX:
<telerik:RadGrid ID="RadGrid1" runat="server" AllowMultiRowSelection="true">
 . . . .  
<telerik:GridTableView Name="Orders" >
. . . .             
<ClientSettings Selecting-AllowRowSelect="true">
  <ClientEvents OnRowSelecting="RowSelecting" />
</ClientSettings>

JS:
<script type="text/javascript">
    function RowSelecting(sender, eventArgs) {
        var tableView = eventArgs.get_tableView();
        if (eventArgs.get_tableView().get_name() != "Orders") {
            if (tableView.get_selectedItems().length == 1) {
                for (var i = 0; i < tableView.get_dataItems().length; i++) {
                    if (tableView.get_dataItems()[i].get_selected()) {
                        tableView.get_dataItems()[i].set_selected(false);
                    }
                }
            }
        }
    }
</script>

Thanks,
Princy
Tags
Grid
Asked by
Venkata
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or