Previous selected item and Clear(Row)Selection Issue

Hi,

I have a component with two SfGrid for input and output Ports.
I want that I just can select one Port at all, not one of every Grid. So I have implemented the RowSelected Event and coded to clear selection of the other Grid.

I have two unexplainable behaviours:

- when I select a row in Grid input, the Clear(Row)Selection of the output Grid is not working: All items in the other Grid are selected. Sometimes nothing happens. If I just use RefreshColumns the grid is deselecting the grid, but I just need clear selection
- when I select a row and click/select another one in the same Grid, the previous row is still marked and if I click on a third one the first marked one is unmarked, and so on...

the Grid implementation:

<SfGrid @ref="@sourceInputPortGrid" TValue="HiCoPort" DataSource="@SourceInputPorts" AllowSelection="true" AllowFiltering="true" Width="100%" Height="100%">
                              <GridSelectionSettings Mode="SelectionMode.Row" Type="Syncfusion.Blazor.Grids.SelectionType.Single"/>
                              <GridEvents TValue="HiCoPort" RowSelected="@SelectedPortSourceEvent" />

                              <GridColumns>
                                 <GridColumn HeaderText="" Width="35" Field="@nameof(HiCoPort.IsMapped)" DisplayAsCheckBox="true">
                                    <FilterTemplate>                                       
                                       <div class="cb_Filter">
                                          <input type="checkbox" @onchange="@(p => FilterBool(p, sourceInputPortGrid))" />
                                       </div>
                                    </FilterTemplate>
                                 </GridColumn>
                                 <GridColumn IsPrimaryKey="true" Field="@nameof(HiCoPort.ID)" Width="60" />
                                 <GridColumn HeaderText="Data Type" Field="@nameof(HiCoPort.DataTypeString)" AutoFit="true" />
                                 <GridColumn Field="@nameof(HiCoPort.Name)" MaxWidth="100%" />
                              </GridColumns>

                           </SfGrid>

 <SfGrid @ref="@sourceOutputPortGrid" TValue="HiCoPort" DataSource="@SourceOutputPorts" AllowSelection="true" AllowFiltering="true" Width="100%" Height="100%">
                              <GridSelectionSettings Mode="SelectionMode.Row" Type="Syncfusion.Blazor.Grids.SelectionType.Single" />
                              <GridEvents TValue="HiCoPort" RowSelected="@SelectedPortSourceEvent" />

                              <GridColumns>
                                 <GridColumn HeaderText="" Width="35" Field="@nameof(HiCoPort.IsMapped)" DisplayAsCheckBox="true">
                                    <FilterTemplate>
                                       <div class="cb_Filter">
                                          <input type="checkbox" @onchange="@(p => FilterBool(p, sourceOutputPortGrid))" />
                                       </div>
                                    </FilterTemplate>
                                 </GridColumn>
                                 <GridColumn IsPrimaryKey="true" Field="@nameof(HiCoPort.ID)" Width="60" />
                                 <GridColumn HeaderText="Data Type" Field="@nameof(HiCoPort.DataTypeString)" AutoFit="true" />
                                 <GridColumn Field="@nameof(HiCoPort.Name)" MaxWidth="100%" />
                              </GridColumns>
                           </SfGrid>

the code behind:

public async Task SelectedPortSourceEvent(RowSelectEventArgs<HiCoPort> args)
      {
         await mappingComponent.BuildMappingComponent(args.Data);
         
         if (args.Data.Direction == CoDirectionEnum.OUTPUT)
         {
            await sourceInputPortGrid.ClearRowSelection();
         }
         else if (args.Data.Direction == CoDirectionEnum.INPUT)
         {
            await sourceOutputPortGrid.ClearRowSelection();
         }

         StateHasChanged();
      }


I hope you can give me some hints. 

Checked the documentation and the forum and implemented like the examples but got this problems.

Best regards,
Bernd

1 Reply

VN Vignesh Natarajan Syncfusion Team February 11, 2021 04:07 AM UTC

Hi Bernd,  

Thanks for contacting Syncfusion support. 

Query: “Previous selected item and Clear(Row)Selection Issue” 

We have analyzed the reported issue by preparing a sample using your code example in 18.4.0.42 (latest version Syncfusion.Blazor Nuget package) and we are not able to reproduce the reported issue at our end. Adjacent grid selection is removed while selecting a row in Grid. And also previous row selection is not maintaining.  

Please find the sample we have used for evaluation from below  


If you are still facing the reported issue, kindly get back to us with following details.  

  1. Are you facing exception/script error in browser console during these behavior. If yes, share the screenshot.
  2. Share the video demonstration of the issue along with replication procedure.
  3. Share your Syncfusion.Blazor Nuget package version.
  4. If possible share issue reproducible sample or try to reproduce the issue in provided sample.

Above requested details will be helpful for us to validate the reported query at our end and provide solution as early as possible.  

Regards, 
Vignesh Natarajan 


Loader.
Up arrow icon