Hi all
Please help me.
How to work it with Blazor (Apply changes to multiple rows while in Batch mode)?
It's like images by Brian Cernoch
Thank you
Hi Mr,
Greetings from Syncfusion support,
Query:” How to work it with Blazor (Apply changes to multiple rows while in Batch mode)?”
We created a solution file based on your requirements. Please see the attached code snippet and sample solution for reference.
<SfButton OnClick="OpenDialog">Update Column</SfButton>
<SfGrid ID="BatchGrid" @ref="Grid" TValue="Order" DataSource="@Orders" AllowPaging="true" Toolbar="@(new List<string>() { "Add", "Edit", "Delete", "Cancel", "Update" })" Height="315"> <GridEditSettings AllowAdding="true" AllowEditing="true" AllowDeleting="true" Mode="EditMode.Batch"></GridEditSettings> ----------------- </SfGrid>
@if (openDialogBtn) {
<SfDialog Width="250px" ShowCloseIcon="true" IsModal="true" @bind-Visible="@IsVisible"> <DialogTemplates> <Content> <div class="input"> <input class='e-input' Placeholder='Enter the value here' @bind-value="@Name" type='text'> </div> </Content>
</DialogTemplates> <DialogButtons> <DialogButton Content="OK" IsPrimary="true" OnClick="@OkClick" /> <DialogButton Content="Cancel" OnClick="@CancelClick" /> </DialogButtons>
</SfDialog>
}
@code{
SfGrid<Order>? Grid{ get; set; }
public List<Order> Orders { get; set; }
List<Order> SelectedRecords { get; set; }
private bool IsVisible { get; set; } = true;
public string Name { get; set; }
private bool openDialogBtn { get; set; } = false;
public void OpenDialog() { openDialogBtn = true; IsVisible = true;
}
public void CancelClick() {
IsVisible = false; }
public void OkClick() { string NewValue = string.Empty; NewValue = Name; SelectedRecords = Grid.SelectedRecords; foreach (var item in SelectedRecords) { item.CustomerID = NewValue; var index = Grid.GetRowIndexByPrimaryKeyAsync(item.OrderID); double value = Convert.ToDouble(index.Result); Grid.UpdateRowAsync(value, item); } Grid.Refresh(); IsVisible = false; } } |
Regards,
Prathap S
Thanks for the update. We are happy to hear that the provided solution was helpful.
We are closing the ticket now.