success function not firing?

2 posts, 0 answers
  1. Scot
    Scot avatar
    5 posts
    Member since:
    Jan 2012

    Posted 14 Aug 2012 Link to this post

    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"
                                            }
                                        }
                                    }
                                }
                             
                        });
  2. Warren
    Warren avatar
    24 posts
    Member since:
    May 2008

    Posted 19 Nov 2012 Link to this post

    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);
                    }
                });
            }
        }
    });
  3. Kendo UI is VS 2017 Ready
Back to Top