RadzenDataGrid / RadzenPager not working when EventCallback<PagerEventArgs> Page is used #534

Closed
opened 2026-01-29 17:38:51 +00:00 by claunia · 6 comments
Owner

Originally created by @MGerdel on GitHub (Sep 7, 2022).

Describe the bug
After #591 has been solved the pager of the DataGrid does not work at all anymore, when the EventCallback Page is used.
The current behaviour is the following:

  • At any time only next- and last page are clickable
  • The DataGrid does not updated anymore when next- or last page are clicked

To Reproduce
Steps to reproduce the behavior:
Use a RadzenDataGrid with Paging and assigned PageCallback (even an empty method does the trick).

Expected behavior
The DataGrid / Paginator should update and work as expected (update content, en- and disable according to the current page).

Screenshots
None

Desktop (please complete the following information):

  • OS: Win 10
  • Browser: Firefox (64 Bit)
  • Version: 104.0

Additional context
None

Originally created by @MGerdel on GitHub (Sep 7, 2022). **Describe the bug** After #591 has been solved the pager of the DataGrid does not work at all anymore, when the EventCallback Page is used. The current behaviour is the following: - At any time only next- and last page are clickable - The DataGrid does not updated anymore when next- or last page are clicked **To Reproduce** Steps to reproduce the behavior: Use a RadzenDataGrid with Paging and assigned PageCallback (even an empty method does the trick). **Expected behavior** The DataGrid / Paginator should update and work as expected (update content, en- and disable according to the current page). **Screenshots** None **Desktop (please complete the following information):** - OS: Win 10 - Browser: Firefox (64 Bit) - Version: 104.0 **Additional context** None
Author
Owner

@enchev commented on GitHub (Sep 8, 2022):

Hey @MGerdel,

We will need minimal repro code.

@enchev commented on GitHub (Sep 8, 2022): Hey @MGerdel, We will need minimal repro code.
Author
Owner

@MGerdel commented on GitHub (Sep 8, 2022):

Hi, thank you for your feedback, if the razor code should not be enough I can add the PageBase code.

Page.razor:

<RadzenDataGrid @ref="@DataGridDraft" ShowPagingSummary="true" Page="@(OnPageChangedDraft)" PagingSummaryFormat="@($"{FromElementDraft}-{ToElementDraft} of {{2}}")" Count="@CampaignsCountDraft" 
				Data="@Campaigns.Where(x => x.Status is NewsStatus.Draft)" TItem="NewsModel" AllowSorting="true" AllowPaging="true" PageSize="@PageSizeDraft" EmptyText="@CampaignsLocalizer["EmptyText"]">
	<Columns>
		<RadzenDataGridColumn TItem="NewsModel" Property="@nameof(NewsModel.Name)" Title="@CampaignsLocalizer["Name"]" HeaderCssClass="table-header" Width="230px">
			<Template Context="context">
				<span class="table-text" title="@context.Name">@context.Name</span>
			</Template>
		</RadzenDataGridColumn>
		<RadzenDataGridColumn TItem="NewsModel" Property="@nameof(NewsModel.Author)" Title="@CampaignsLocalizer["Author"]" HeaderCssClass="table-header" Width="206px">
			<Template Context="context">
				<span class="table-text" title="@context.Author">@context.Author</span>
			</Template>
		</RadzenDataGridColumn>
		<RadzenDataGridColumn TItem="NewsModel" Property="@nameof(NewsModel.CreatedAt)" Title="@CampaignsLocalizer["CreatedAt"]" HeaderCssClass="table-header" Width="206px">
			<Template Context="context">
				<span class="table-text" title="@GetTextOrDefault(context.CreatedAt))">@GetTextOrDefault(context.CreatedAt)</span>
			</Template>
		</RadzenDataGridColumn>
		<RadzenDataGridColumn TItem="NewsModel" Title="@CampaignsLocalizer["Actions"]" HeaderCssClass="table-header" Width="108px" Sortable="@false">
			<Template Context="campaign">
				<div>
					<span>
						<RadzenButton class="dial-undecorated-icon-button" Click="@(() => EditCampaignAsync(campaign))">
							<em class="appicons appicons-edit button-icon"></em>
						</RadzenButton>
					</span>
					<span>
						<RadzenButton class="dial-undecorated-icon-button" Click="@(() => DeleteCampaignAsync(campaign))">
							<em class="appicons appicons-delete button-icon"></em>
						</RadzenButton>
					</span>
				</div>
			</Template>
		</RadzenDataGridColumn>
	</Columns>
</RadzenDataGrid>

@code {

    private string GetTextOrDefault(DateTime? time) => GeneralLocalizer.NumberFormatter.ToShortDateString(time);

}
@MGerdel commented on GitHub (Sep 8, 2022): Hi, thank you for your feedback, if the razor code should not be enough I can add the PageBase code. Page.razor: ``` <RadzenDataGrid @ref="@DataGridDraft" ShowPagingSummary="true" Page="@(OnPageChangedDraft)" PagingSummaryFormat="@($"{FromElementDraft}-{ToElementDraft} of {{2}}")" Count="@CampaignsCountDraft" Data="@Campaigns.Where(x => x.Status is NewsStatus.Draft)" TItem="NewsModel" AllowSorting="true" AllowPaging="true" PageSize="@PageSizeDraft" EmptyText="@CampaignsLocalizer["EmptyText"]"> <Columns> <RadzenDataGridColumn TItem="NewsModel" Property="@nameof(NewsModel.Name)" Title="@CampaignsLocalizer["Name"]" HeaderCssClass="table-header" Width="230px"> <Template Context="context"> <span class="table-text" title="@context.Name">@context.Name</span> </Template> </RadzenDataGridColumn> <RadzenDataGridColumn TItem="NewsModel" Property="@nameof(NewsModel.Author)" Title="@CampaignsLocalizer["Author"]" HeaderCssClass="table-header" Width="206px"> <Template Context="context"> <span class="table-text" title="@context.Author">@context.Author</span> </Template> </RadzenDataGridColumn> <RadzenDataGridColumn TItem="NewsModel" Property="@nameof(NewsModel.CreatedAt)" Title="@CampaignsLocalizer["CreatedAt"]" HeaderCssClass="table-header" Width="206px"> <Template Context="context"> <span class="table-text" title="@GetTextOrDefault(context.CreatedAt))">@GetTextOrDefault(context.CreatedAt)</span> </Template> </RadzenDataGridColumn> <RadzenDataGridColumn TItem="NewsModel" Title="@CampaignsLocalizer["Actions"]" HeaderCssClass="table-header" Width="108px" Sortable="@false"> <Template Context="campaign"> <div> <span> <RadzenButton class="dial-undecorated-icon-button" Click="@(() => EditCampaignAsync(campaign))"> <em class="appicons appicons-edit button-icon"></em> </RadzenButton> </span> <span> <RadzenButton class="dial-undecorated-icon-button" Click="@(() => DeleteCampaignAsync(campaign))"> <em class="appicons appicons-delete button-icon"></em> </RadzenButton> </span> </div> </Template> </RadzenDataGridColumn> </Columns> </RadzenDataGrid> @code { private string GetTextOrDefault(DateTime? time) => GeneralLocalizer.NumberFormatter.ToShortDateString(time); } ```
Author
Owner

@enchev commented on GitHub (Sep 8, 2022):

@MGerdel we need runnable code example

@enchev commented on GitHub (Sep 8, 2022): @MGerdel we need runnable code example
Author
Owner

@MGerdel commented on GitHub (Sep 8, 2022):

I have created a repo to reproduce this issue for you:
Example

On the Index page you will find the DataGrid with the mentioned issue.

@MGerdel commented on GitHub (Sep 8, 2022): I have created a repo to reproduce this issue for you: [Example](https://github.com/MGerdel/RadzenExample) On the Index page you will find the DataGrid with the mentioned issue.
Author
Owner

@MGerdel commented on GitHub (Sep 8, 2022):

@enchev Thank you again for your time and fix, but won't this fix bring back #591?
If I understand the code correctly, the assigned callback for page would now prevent the recalculation of the paginator properties.

@MGerdel commented on GitHub (Sep 8, 2022): @enchev Thank you again for your time and fix, but won't this fix bring back #591? If I understand the code correctly, the assigned callback for page would now prevent the recalculation of the paginator properties.
Author
Owner

@vperumal88 commented on GitHub (Apr 2, 2025):

RadzenGrid<> FirstPage () getting null exception error

@vperumal88 commented on GitHub (Apr 2, 2025): RadzenGrid<> FirstPage () getting null exception error
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/radzen-blazor#534