Problem multiselecting rows

I need to be able to select multiple rows in a grid. I think I have setup the grid correctly but multi-selection is not working. One thing different about the grid is I call StartEdit() when a row is clicked, and I am wondering if that is preventing multiple selection.

                    <SfGrid @ref="PcbBoards" ID="PcbBoards" DataSource="@module.PCB_Boards">
                        <GridEvents RowSelected="@PCBRowSelected" TValue="PCB" DataBound="PCBDataBound" DetailDataBound="DetailDataBound" />
                        <GridTemplates>
                            <DetailTemplate>
                                @{
                                    var pcb = (context as PCB);
                                    <SfGrid DataSource="@pcb.Components" ShowColumnChooser="true"   AllowSorting="true" AllowFiltering="true" GridLines="GridLine.Both" AllowPaging="true" Height="75%" AllowResizing="true" ID="ComponentGrid" @ref="ComponentGrid">
                                        <GridSelectionSettings PersistSelection="true" />
                                        <GridEditSettings AllowEditing="true" />
                                        <GridPageSettings PageCount="2" PageSize="20" />
                                        <GridFilterSettings Type="Syncfusion.Blazor.Grids.FilterType.Excel"/>
                                        <GridSelectionSettings EnableSimpleMultiRowSelection="true" Mode="Syncfusion.Blazor.Grids.SelectionMode.Row"/>
                                        <GridEvents Created="OnComponentGridCreated" RowSelected="@ComponentRowSelected" TValue="PCB_Component" OnRecordClick="OnComponentRecordClicked" />

                                        <GridColumns>
                                            <GridColumn Field=@nameof(PCB_Component.Installed) Width="10%" Type="ColumnType.Boolean" EditType="EditType.BooleanEdit" DisplayAsCheckBox="true"  />
                                            <GridColumn Field=@nameof(PCB_Component.Name) IsPrimaryKey="true" HeaderText="Component" Width="100" AllowEditing="false" />
                                            <GridColumn Field=@nameof(PCB_Component.Description) HeaderText="Description" Width="200" AllowEditing="false" />
                                            <GridColumn Field=@nameof(PCB_Component.Package) HeaderText="Package" AllowEditing="false" />
                                        </GridColumns>

                                    </SfGrid>
                                }
                            </DetailTemplate>
                        </GridTemplates>
                        <GridColumns>
                            <GridColumn Field=@nameof(PCB.Name) HeaderText="PCB" Width="200" />
                        </GridColumns>
                    </SfGrid>

1 Reply 1 reply marked as answer

RS Renjith Singh Rajendran Syncfusion Team October 19, 2020 10:41 AM UTC

Hi Jim, 

Greetings from Syncfusion support. 

We suggest you to ensure to set the Type property of GridSelectionSettings as Multiple to enable multi selection in Grid. Please refer and add the below highlighted code, 

 
<GridSelectionSettings EnableSimpleMultiRowSelection="true" Type="SelectionType.Multiple" Mode="Syncfusion.Blazor.Grids.SelectionMode.Row" /> 


Please refer the documentation below, 

Query : One thing different about the grid is I call StartEdit() when a row is clicked, and I am wondering if that is preventing multiple selection. 
Yes, when perform single click edit in Grid, the selection action will trigger Edit action in Grid. So at these case you can’t perform multi-selection, as clicking on row will move the row to edited state. If you remove single click edit from your code, you can perform multi selection in Grid when enabled the above highlighted property. 

Please get back to us if you need further assistance. 

Regards, 
Renjith Singh Rajendran 


Marked as answer
Loader.
Up arrow icon