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

Grid's row DELETE button does not immediately post

3 Answers 165 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Craig
Top achievements
Rank 1
Craig asked on 19 Nov 2012, 02:15 PM
I've been using the Grid successfully to implement paging, sorting, filtering via server-side POSTs, it all works great. However, I am having trouble getting the DELETE buttons (and possibly UPDATE as well) to immediately post, it seems like the control is waiting/batching them up... and I don't want that behavior. I want immediate POSTs for delete and update.

Can anyone see where I'm going wrong here?

Thanks,
Craig


<script type="text/javascript">
    $(function () {
        $("#employeesGrid").kendoGrid({
            toolbar: ["create", "save", "cancel"],
            columns: [
                { field: "FirstName", title: "First Name" },
                { field: "LastName", title: "Last Name" },
                { command: "destroy" }
            ],
            dataSource: new kendo.data.DataSource({
                transport: {
                    read: {
                        url: "api/Customer",
                        type: "POST",
                        contentType: "application/json"
                    },
                    destroy: {
                        url: "api/Customer/Delete",
                        type: "POST"
                        //contentType: "application/json"
                    },
                    parameterMap: function (options, operation) {
                        if (operation === "read")
                            return kendo.stringify(options);
                        else
                            return options;
                    }
                },
                schema: { data: "Data", total: "Count", model: { id: "Id"} },
                pageSize: 5,
                serverPaging: true,
                serverSorting: true,
                error: function (e) {
                    console.log(e.statusText);
                }
            }),
            batch: false,
            editable: {
                //mode: "popup",
                destroy: true
            },
            scrollable: false,
            sortable: true,
            pageable: true
        });
    });
</script>

3 Answers, 1 is accepted

Sort by
0
Petur Subev
Telerik team
answered on 22 Nov 2012, 02:11 PM
Hello Craig,

The default editing mode is InCell which behavior is to save the changes locally and then peform request (or multiple requests for each change - depending if the batch option of the dataSource is set to true or not).
If you set the mode to inline the requests will be started immediately after you press the update/delete button.

e.g.

editable: { mode:"inline",destroy: true }


Kind Regards,
Petur Subev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Chance
Top achievements
Rank 2
answered on 12 Jun 2014, 03:00 PM
How can I immediately delete for batch mode?
I want the toolbar commands to have the batch behavior but the deletes to be immediate.

Thanks
0
Petur Subev
Telerik team
answered on 16 Jun 2014, 08:45 AM
Hello Craig,

I assume that the option that you are looking for is the autoSync option of the dataSource:

http://docs.telerik.com/kendo-ui/api/framework/datasource#configuration-autoSync

It will perform a ajax request immediately after any change made to the dataSource.

Regards,
Petur Subev
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Grid
Asked by
Craig
Top achievements
Rank 1
Answers by
Petur Subev
Telerik team
Chance
Top achievements
Rank 2
Share this question
or