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

delete/save buttons not calling controller

1 Answer 41 Views
Grid
This is a migrated thread and some comments may be shown as answers.
George
Top achievements
Rank 1
George asked on 22 Jan 2020, 06:56 PM

I've been trying to get this working for a few days and no solution. I have a [delete] button on each row of my grid and when I click it, it never calls the destroy method in the data source. I have the same issue when trying to create as well, Read works fine: Am I missing something, wrong format, etc.

Datasource:

var ds = new kendo.data.DataSource({
       transport: {
            create:
               {
                    url: '@Url.Action ("CreateSales", "Sales", new { area = "sales"})',
                    datatype: "JSON",
                    type: "POST",
                    cache: false,
                    complete: function(xhr, status)
                                 {
                                      $("#sales").data.('kendoGrid').datasource.read();
                                 }
              },
             destroy:
              {
                  url: '@Url.Action("RemoveSales", "Sales", new { area = "sales"})',
                  datatype:  "JSON",
                  type: "POST",
                  complete: function(xhr, status) {
                       $("#sales").data('kendoGrid').datasource.read();
                               
                     }
              } ,
            parameterMap; function (items)
                     { return $.param(items);
          }
}
 
});
$("#sales").kendoGrid(
            {
                dataSource: ds,
                pageable: true,
                scrollable: true,
                sortable: {
                    mode: 'multiple'
                },
                height: 440,
                   toolbar: [{ name: "create", text: "Save" },
                   ],
                columns: [
                        { field: "Name", title: "Name", width: "300px" },
                        { field: "Location", title: "Location" },
                        { command: ["destroy"], title: " ", width: "100px" },
                   ]
            });

and the method in the controller: the delete/destroy never calls this

[httpPost]
public JsonResult RemoveSales(Sales items)
{
    //calls stored procedure to delete the user
 
 
}

1 Answer, 1 is accepted

Sort by
0
George
Top achievements
Rank 1
answered on 23 Jan 2020, 12:43 AM

This has been resolved.

 

 

Tags
Grid
Asked by
George
Top achievements
Rank 1
Answers by
George
Top achievements
Rank 1
Share this question
or