使用radzen对话框的blazor radzen网格是/否



我正在为blazor使用radzen,如何获得TItem="MailTemplate";是否传入是/否对话框服务?

<RadzenGrid @ref="m_gridTemplates" Data="@m_emailTemplates" TItem="MailTemplate" AllowScrolling="true" AllowPaging="true" PageSize="10" EditMode="DataGridEditMode.Single">

<RadzenButton ButtonStyle="ButtonStyle.Danger" Icon="close" Size="ButtonSize.Small" Click=@(args => DialogService.Confirm("Are you sure?", "Delete Template (" +mailTemplate.FileName + ")", new ConfirmOptions() { OkButtonText = "Yes", CancelButtonText = "No" })) MouseEnter="@(args => ShowTooltip(args, new TooltipOptions(){ Position = TooltipPosition.Top ,Text = "Delete Template"}))"/>

我知道这有点晚了,但我只是有同样的问题,在Radzen论坛上得到了这个答案的帮助:https://forum.radzen.com/t/confirmation-modal-dialog/4069/8

其基本思想是,不直接调用DialogService.Confirm方法,而是从您自己的方法中调用它,您已经传递了所需的任何内容

在链接损坏的情况下:

<RadzenButton ButtonStyle="ButtonStyle.Danger" Icon="delete" Text="Delete" Click="@(args => ConfirmDelete(yourObject.Id))" @onclick:stopPropagation="true"></RadzenButton>
public async Task ConfirmDelete(int id)
{
var confirmationResult = await this.DialogService.Confirm("Are you sure?", "Dialog Title", new ConfirmOptions { OkButtonText = "Yes", CancelButtonText = "No" });
if (confirmationResult == true)
{
//Delete logic for id
}
}

TItem="MailTemplate";看起来像一个类型,而不是一个值。注意,我使用的是RadzenDataGrid,而不是RadzenGrid。这是我的代码示例,修改Type";订单";,具有值";订单";,并且从数据源";订单">

<RadzenGrid Data="@Orders" TItem="Order" AllowScrolling="true" AllowPaging="true" PageSize="10" EditMode="DataGridEditMode.Single">
<Columns>
<RadzenDataGridColumn TItem="Order" Context="ord" Filterable="false" Sortable="false" TextAlign="TextAlign.Center" Width="130px" Title="Remove order reference">
<Template Context="ord">
<RadzenButton ButtonStyle="ButtonStyle.Danger" Icon="assignment_turned_in" Size="ButtonSize.Small" Click="@(args => editOrder(ord))"></RadzenButton>
</Template>
</RadzenDataGridColumn>
</Columns>
</RadzenGrid>
@Code{
async Task editOrder(Order order)
{
order = null;
}
}

相关内容

  • 没有找到相关文章

最新更新