Hi all,
I have a multiselect datagrid and i followed the online demo example to implement it.
https://blazor.radzen.com/datagrid-multiple-selection
I am facing the problem that when the user selects a record the datagrid moves to top if i don't have enabled the paging otherwise moves to the first page, again in top but using the pages. This is something that is not happening in the online demo.
Any suggestions please?
Well after a lot of searching following is my grid component
<RadzenDataGrid @ref="usersGrid"
Data="@ADUsers"
TItem="ADUserModel"
SelectionMode="DataGridSelectionMode.Multiple"
@bind-Value="@SelectedUsers"
IsLoading="@isLoading"
AllowRowSelectOnRowClick="@allowRowSelectOnRowClick"
AllowFiltering="false"
FilterCaseSensitivity="FilterCaseSensitivity.CaseInsensitive"
FilterMode="FilterMode.Advanced"
LogicalFilterOperator="LogicalFilterOperator.Or"
AllowColumnResize="false"
AllowSorting="false"
AllowPaging="false"
PageSize="10"
PagerHorizontalAlign="HorizontalAlign.Left"
ShowPagingSummary="false"
ColumnWidth="200px">
<EmptyTemplate>
<p style="color: lightgrey; font-size: 24px; text-align: center; margin: 2rem;">No records to display.</p>
</EmptyTemplate>
<Columns>
<RadzenDataGridColumn TItem="ADUserModel" Width="40px" Sortable="false" Filterable="false">
<HeaderTemplate>
<RadzenCheckBox TriState="false" TValue="bool" Value="@(ADUsers.Any(i => SelectedUsers != null && SelectedUsers.Contains(i)))"
Change="@(args => SelectedUsers = args ? ADUsers.ToList() : null)" />
</HeaderTemplate>
<Template Context="data">
<RadzenCheckBox TriState="false" Value="@(SelectedUsers != null && SelectedUsers.Contains(data))"
TValue="bool" Change=@(args => { if(!allowRowSelectOnRowClick) { usersGrid.SelectRow(data); }})/>
</Template>
</RadzenDataGridColumn>
<RadzenDataGridColumn TItem="ADUserModel" Property="DisplayName" Title="Name" Frozen="true" Width="140px" />
<RadzenDataGridColumn TItem="ADUserModel" Property="UserPrincipalName" Title="User Principal Name" Width="140px"/>
<RadzenDataGridColumn TItem="ADUserModel" Property="Email" Title="Email" Width="140px"/>
</Columns>
</RadzenDataGrid>
I found that when i enable the paging then when i select a record, the datagrid moves to top (goes to the first page). If I turn to false the paging then it works as expected. In case i want the grid to be scrollable, meaning that i will add the style="Height: 500px" for example, in order to make the data of the grid scrollable and keep the header row visible, then when i select a record from the bottom for example, the grid moves to top again.
Any suggestions? @enchev can you please help, make any suggestions on that?
Thanks in advance