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

success function not firing?

1 Answer 273 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Scot
Top achievements
Rank 1
Scot asked on 14 Aug 2012, 07:29 PM
I am defining the code as below, the url fires but i dont get a message in the console for the success event? What did I do wrong?

var dataSource = new kendo.data.DataSource({
                           
                            transport: {
                                read:  {
                                    url: "cfcs/loadCSR.cfm",
                                    cache: false                                    
                                },
                               destroy:  {
                                    url: "cfcs/deleteCSR.cfm",
                                    cache: false,
                                    type: "POST",
                                    success: function(result){
                                        console.log("lol");
                                    }
                                }
                            },
                            batch: true,
                            pageSize: 30,
                            schema: {
                                data: "data",
                                model: {
                                    id: "BADGEID",
                                    fields: {
                                        BADGEID: {
                                            type: "number"
                                        },
                                        EMPLOYEENAME: {
                                            type: "string"
                                        },
                                        UNITID: {
                                            type: "number"
                                        },
                                        UNITNAME: {
                                            type: "string"
                                        }
                                    }
                                }
                            }
                         
                    });

1 Answer, 1 is accepted

Sort by
0
Warren
Top achievements
Rank 2
answered on 19 Nov 2012, 06:47 AM
I know this is an older post but for any other with the same question, change the destroy to a function and make it an ajax call.

Here is the link to how to accomplish firing the "success".
http://docs.kendoui.com/api/framework/datasource#transportdestroy-objectstringfunction
var dataSource = new kendo.data.DataSource({
    transport: {
        destroy: function(options) {
            // make AJAX request to the remote service
 
            $.ajax( {
                url: "/orders/destroy",
                data: options.data, // the "data" field contains paging, sorting, filtering and grouping data
                success: function(result) {
                    // notify the DataSource that the operation is complete
 
                    options.success(result);
                }
            });
        }
    }
});
Tags
Grid
Asked by
Scot
Top achievements
Rank 1
Answers by
Warren
Top achievements
Rank 2
Share this question
or