This is a migrated thread and some comments may be shown as answers.

Destroy method isn't called at all

1 Answer 343 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Adrian
Top achievements
Rank 1
Adrian asked on 27 Aug 2018, 12:20 PM

Hello, I'm creating simple grid, which is populated with data via controller and it's work just fine.

But the problem is when I'm trying to remove a row with .Destroy() method, which doesn't call method from my controller.

 

                         .DataSource(dataSource => dataSource
                                    .Ajax()
                                    .Read(read => read.Action("Read", "controller")) <-- this works well
                                    .Destroy(destroy => destroy.Action("Read", "controller"))) <-- isn't called at all

 

method in controller

        public ActionResult Delete([DataSourceRequest] DataSourceRequest request, Model model)
        { <-- I've put breakpoint here and it's not get there
            return NotFound();
        }

I have no idea where the problem is.

1 Answer, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 30 Aug 2018, 05:41 AM
Hello, Adrian,

After inspecting the code and noticed that the Destroy is actually calling the Read action:

.Destroy(destroy => destroy.Action("Read", "controller"))) <-- isn't called at all

If this is only a typo inside the ticket, another reason could be that the Model.ID is not set.

If both are correctly set, please share a short video of the case with the network tab open or provide an example reproducing the issue. This will help us locate the issue and provide a suggestion best suited for it.

Regards,
Stefan
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
Grid
Asked by
Adrian
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Share this question
or