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