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

Delete removes from grid but does not fire on server.

1 Answer 22 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Chad
Top achievements
Rank 1
Chad asked on 22 Oct 2015, 06:36 PM

I have a grid that shows all uploaded documents. I want to be able to delete those documents. When I click the delete button I would like a confirmation to popup and then the delete to fire to the server. I have done this before and copied my code from another project. However it is not working and I can't seem to figure out why. 

 

var viewModel = new kendo.observable({
    rfpId: $('#RFPId').val(),
    isContinueEnabled: false,
    documentsDataSource: new kendo.data.DataSource({
        transport: {
            read: {
                url: "/RFP/GetDocuments",
                data: { id: $('#RFPId').val() },
                dataType: "json"
            },
            destroy: {
                url: "/RFP/DeleteDocument",
                dataType: "json"
            },
            schema: {
                model: {
                    fields: {
                        Id: { editable: false, nullable: true},
                        Name: { type: "string" },
                        CreateDate: { type: "date" }
                    }
                }
            }
    },
    pageSize: 10,
    serverPaging: false,
    serverFiltering: false,
    serverSorting: false
}),
    reloadDocuments: function () {
        this.get("documentsDataSource").read();
    }
});

 

    $("#GridUploadedDocuments").kendoGrid({
        dataSource: viewModel.get("documentsDataSource"),
        filterable: false,
        sortable: false,
        pageable: true,
        scrollable: false,        
        columns: [
            { field: "Name", title: "Name"},
            { field: "CreateDate", title: "Date/Time", width: "150px", template: "#= kendo.toString(kendo.parseDate(CreateDate, 'MM-dd-yyyy hh:mm tt'), 'MM-dd-yyyy hh:mm tt') #" },
            { command: ["destroy"], title: " ", width: "120px" }],
        editable: {
            update: false,
            destroy: true,
            mode: "inline"
        }
    });

 

 

I have no errors in Firebugs. I have Fiddler open and no attempt to hit the server is being made. I am sure it is a simple error. 

1 Answer, 1 is accepted

Sort by
0
Alexander Popov
Telerik team
answered on 26 Oct 2015, 12:15 PM
Hi Chad,

The configuration seems correct, however I would suggest trying to explicitly specify the schema.model's ID field.

Regards,
Alexander Popov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Grid
Asked by
Chad
Top achievements
Rank 1
Answers by
Alexander Popov
Telerik team
Share this question
or