kendo grid delete command not working

前端 未结 5 1804
青春惊慌失措
青春惊慌失措 2020-12-31 04:57

i have developed a web application using kendo ui tools and theres a kendo grid with batch edit mode..

but when i press the delete

5条回答
  •  甜味超标
    2020-12-31 05:24

    If you choose not to include editable.mode in order to utilize the in-cell editing, you can set the toolbar of the grid to include the option save:

    $("#grid").kendoGrid({
        dataSource: {
            transport: {
                ....
            },
            schema: {
                ....
            }
        },                        
        toolbar: ["create", "save", "cancel"],
        columns: [
            ....
        ],
        editable: true
    });
    

    This will create a save button at the toolbar of the grid. After deleting any records by clicking the destroy command button, click on the save button to have the grid to make an Ajax call to the server to delete the record.

    If you would rather delete the record automatically without including the save button, you could add a change event handler to the datasource of the grid:

    $("#grid").kendoGrid({
        dataSource: {
            transport: {
                ....
            },
            schema: {
                ....
            },
            change: function(e) {
                if (e.action === "remove") {
                    this.sync();
                }
            }
        },                        
        columns: [
            ....
        ],
        editable: true
    });
    

    This will automatically sync the changes you made to the grid with the server when there's a data change.

提交回复
热议问题