We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

how to set all grid cell to edit mode or dirty in code?

hi

I add the records to the list by code and then bind them to the grid and then store them in the database.

I want the toolbar button to be activated immediately after binding to list.

how to set state all rows to edit mode without changing grid cell value?

how to enable save button on toolbar?

i dont use GridInstance.AddRecordAsync(data) to add records to grid

Is there a flag to enable cell editing?


Attachment: BlazorApp2_a1b3ad22.zip

1 Reply

NP Naveen Palanivel Syncfusion Team December 7, 2022 03:08 AM UTC

Hi Ali,


Greetings from Syncfusion support


We have analyzed your query and we would like to inform that, There is not possible to set all grid cell to edit mode in batch edit. We also prepared sample for enable save button on toolbar and a flag to enable cell editing by using button click to enable edit mode. Please refer the attached sample and snippet code for your reference


<SfButton OnClick="@Enable">EnableEdit</SfButton>

<SfGrid DataSource="@Orders" @ref="Grid" AllowPaging="true" Toolbar=@ToolbarItems Height="315">

<GridEditSettings AllowAdding="true" AllowEditing="@Allowedit" AllowDeleting="true" Mode="EditMode.Batch"></GridEditSettings>

                                                          &&

 

private List<object> ToolbarItems = new List<object>() {

        new ItemModel() { Text = "Add Record", PrefixIcon = "e-add", Id = "Grid_add"},//Here Grid is SfGrid ID

        new ItemModel(){ Text = "Edit Record", PrefixIcon= "e-edit", Id="Grid_edit"},

        new ItemModel(){ Text = "Delete Record", PrefixIcon= "e-delete", Id="Grid_delete"},

        new ItemModel(){ Text = "Update Record", PrefixIcon= "e-update", Id="Grid_update"},

        new ItemModel(){ Text = "Cancel Changes", PrefixIcon= "e-cancel", Id="Grid_cancel"},

 

    };

 

 

    public bool Allowedit = false;

 

    public void Enable()

    {

        Allowedit = true;

    }

 

    public void ToolbarClickHandler(Syncfusion.Blazor.Navigations.ClickEventArgs args)

    {

        if (args.Item.Text == "Update Record")

        {

            Grid.EndEditAsync();

        }

       if (args.Item.Text == "Delete Record")

        {

            Grid.DeleteRecordAsync();

        }

        if (args.Item.Text == "Cancel Changes")

        {

            Grid.CloseEditAsync();

        }

    }



Please let us know if you have any concerns.


Regards,

Naveen Palanivel


Attachment: BlazorApp0612_(2)_51d4f9eb.zip

Loader.
Up arrow icon