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

Multi Row Select

2 Answers 78 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Bishara
Top achievements
Rank 1
Bishara asked on 01 Feb 2016, 12:43 PM
Hello Telerik, Im trying to enable multi row select in rad grid without a check box for selecting, only on any row cell click i can select, and on another row click, it keep the previous selected row, im trying to do so client side, is there any way to implement that

2 Answers, 1 is accepted

Sort by
0
Konstantin Dikov
Telerik team
answered on 01 Feb 2016, 12:58 PM
Hi BIshara,

In order to select multiple rows without the GridClientSelectColumn, the user have to hold the "CTRL" key (the common approach for multiple selection). However, if you need to enable multiple selection without the "CTRL" key you could use the following approach to override the built-in behavior:
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
    <script type="text/javascript">
        var targetSelectItem;
 
        function rowClick(sender, args) {
            targetSelectItem = args.get_gridDataItem();
            if (targetSelectItem.get_selected()) {
                setTimeout(function () {
                    targetSelectItem.set_selected(false);
                })
            }
        }
 
        function rowDeselecting(sender, args) {
            if (args.get_gridDataItem().get_itemIndexHierarchical() != targetSelectItem.get_itemIndexHierarchical()) {
                args.set_cancel(true);
            }
        }
    </script>
</telerik:RadCodeBlock>
 
<telerik:RadGrid runat="server" ID="RadGrid1" OnNeedDataSource="RadGrid1_NeedDataSource" AllowMultiRowSelection="true">
    <ClientSettings>
        <Selecting AllowRowSelect="true" />
        <ClientEvents OnRowDeselecting="rowDeselecting" OnRowClick="rowClick" />
    </ClientSettings>
</telerik:RadGrid>

Hope this helps.


Regards,
Konstantin Dikov
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Bishara
Top achievements
Rank 1
answered on 01 Feb 2016, 01:24 PM
Thank you :) , Perfectly Worked
Tags
Grid
Asked by
Bishara
Top achievements
Rank 1
Answers by
Konstantin Dikov
Telerik team
Bishara
Top achievements
Rank 1
Share this question
or