Custom Requirement in Grid ~ Branched from F169891

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

https://www.syncfusion.com/forums/169891/apply-changes-to-multiple-rows-while-in-batch-mode?reply=Sopiwh

Thank you


3 Replies

PS Prathap Senthil Syncfusion Team December 5, 2022 01:59 PM UTC

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


Attachment: SampleDataGrid_b1f708a.zip


MR Mr replied to Prathap Senthil December 5, 2022 02:14 PM UTC

Hi Prathap Senthil

Thank you very much for sharing the details.

Best regards,

Mr.Binh



PS Prathap Senthil Syncfusion Team December 6, 2022 06:48 AM UTC

Thanks for the update. We are happy to hear that the provided solution was helpful.


We are closing the ticket now.


Loader.
Up arrow icon