"No records selected for delete operation"

Hi Team Syncfusion,

I have a SfGrid and everything seems to work fine with the exception of delete.  When pressing the delete button I get the following message:

`No records selected for delete operation`

I am curious what I might be overlooking to enable this functionality.  I did a search on this error/dialog message and nothing obvious returned.

Thank you for any assistance you can provide.


8 Replies 1 reply marked as answer

MS Monisha Saravanan Syncfusion Team August 31, 2022 12:05 PM UTC

Hi Mike,


Greetings from Syncfusion support.


Query: “I have a SfGrid and everything seems to work fine with the exception of delete.  When pressing the delete button I get the following message `No records selected for delete operation` ”


We would like to inform that before performing Delete operation in DataGrid we should select an row. Based on the selected record the delete operation will be performed. We have prepared an video demo. Kindly check the attached video for your reference.


Video: https://www.syncfusion.com/downloads/support/directtrac/general/ze/Delete-video-1302999056.zip


Kindly get back to us if you have further queries.


Regards,

Monisha



MI Mike-E September 3, 2022 08:56 AM UTC

Thank you for the update/suggestion here @Monisha.  I am attempting to select a row in my solution but it appears that I cannot.  Do you have the code for the provided video?  I would like to compare it with what I have to see if I can spot the difference.

Thank you for any continued assistance you can provide.



NP Naveen Palanivel Syncfusion Team September 5, 2022 08:59 PM UTC

Hi Mike-E


We checked your query, as per the requirement we prepared the sample for the delete operation. We attached the sample in this ticket and also UG documentation link below for more information. Please refer the sample and UG documentation for your reference.


Reference: https://blazor.syncfusion.com/documentation/datagrid/editing


Please get back to us if you need further assistance



Regards,

Naveen Palanivel


Attachment: BlazorApp1_f6e3b3aa.zip


MI Mike-E September 6, 2022 12:13 PM UTC

Thank you for working with me here @Naveen, and for your great customer service.  I can verify that your provided solution works as expected.  I will work from there to see if I can get you a minimal reproduction from my code.  My hunch is that this might be due to the use of a custom data adaptor.  I will update here accordingly.



MI Mike-E September 7, 2022 06:43 PM UTC

LOL... turns out I was using `AllowSelection="false"` 🤦‍♂️

Maybe this will help someone else running into the same issue.

Thank you again for your assistance and patience!


Marked as answer

NP Naveen Palanivel Syncfusion Team September 8, 2022 12:24 AM UTC

Hi Mike-E,


Welcome


We are glad to hear that your query has been resolved by you.


Please get back to us if you need further assistance.


Regards,

Naveen Palanivel.



AE Ahmed Eldamity replied to Naveen Palanivel November 30, 2024 07:00 AM UTC

How can I change the text of this popup?



PS Prathap Senthil Syncfusion Team December 3, 2024 03:58 PM UTC

Hi Ahmed Eldamity,

Based on the requirement to prevent the default action popup message when row records are selected during a delete operation, we suggest customizing the appearance and contents of the delete dialog by rendering a customized SFDialog instead of the default dialog.Kindly refer to the code example and sample provided below for your reference.

<SfGrid DataSource="@Orders" @ref="Grid" ID="Grid" AllowPaging="true" Toolbar="@(new List<string>() { "Add", "Edit", "Delete", "Cancel", "Update" })" Height="315">

    <GridEditSettings AllowAdding="true" AllowEditing="true" AllowDeleting="true" ></GridEditSettings>

    <GridEvents OnToolbarClick="Clicked"  TValue="Order"></GridEvents>

</SfGrid>

 

 

<SfDialog Width="250px"  IsModal="true" @bind-Visible="@IsVisible">

    <DialogTemplates>

        <Content> Records not selected.</Content>

    </DialogTemplates>

    <DialogButtons>

        <DialogButton Content="OK" IsPrimary="true" OnClick="@OkClick" />

 

    </DialogButtons>

</SfDialog>

 

 

@code {

    public List<Order> Orders { get; set; }

    private bool IsVisible { get; set; } = false;

 

    SfGrid<Order> Grid { get; set; }

 

    private async Task OkClick()

    {

        this.IsVisible = false;

 

 

    }

 

 

 

    public async Task Clicked(Syncfusion.Blazor.Navigations.ClickEventArgs Args)

    {

        if (Args.Item.Text == "Delete")

        {

            if(Grid.SelectedRecords.Count == 0)

            {

                Args.Cancel = true;

                IsVisible = true;

            }

         

        }

    }

 

}


Sample:https://blazorplayground.syncfusion.com/embed/rXrpirtLUFuVANcf?appbar=true&editor=true&result=true&errorlist=true&theme=bootstrap5

Reference:
Events in Blazor DataGrid Component | Syncfusion
https://blazor.syncfusion.com/documentation/dialog/getting-started

Regards,
Prathap Senthil


Loader.
Up arrow icon