Cancel on edit giving error

3 posts, 0 answers
  1. Rich
    Rich avatar
    22 posts
    Member since:
    Feb 2012

    Posted 15 Jul 2013 Link to this post

    Everything on my grid is working great except when they click update and then cancel they get an error. "Unexpected number"

    Here is the code. the functions applist, companylist, etc just populate the edit dropdowns. They seem to be generaign find though. Any ideas?

    var crudServiceBaseUrl = "main.php?a=quote_detail", dataSource = new kendo.data.DataSource({
        transport : {
            read : {
                url : crudServiceBaseUrl + "&read=1",
                dataType : "json"
            },
            update : {
                url : crudServiceBaseUrl + "&update=1",
                dataType : "json",
                complete: function(e) {
                            $("#grid").data("kendoGrid").dataSource.read();
                }                   
            },
            destroy : {
                url : crudServiceBaseUrl + "&destroy=1",
                dataType : "json"
            },
            create : {
                url : crudServiceBaseUrl + "&create=1",
                dataType : "json",
                complete: function(e) {
                            $("#grid").data("kendoGrid").dataSource.read();
                }                   
            }
        },
        batch : true,
        pageSize : 10,
        serverPaging : true,
        serverFiltering : true,
        serverSorting : true,
        
        schema : {
            data: "data",
            total: "total",
            model : {
                id : "ID",
                fields : {
                    company : {
                        validation : {
                            required : true
                        }
                    },
                    effective_date : {
                        validation : {
                            required : true
                        }
                    },
                    fee : {
                        validation : {
                            required : true
                        }
                    },
                    guarantee : {
                        validation : {
                            required : true
                        }
                    },
                    state : {
                        validation : {
                            required : true
                        }
                    },
                    application : {
                    }
                }
            }
        }
    });
     
    $("#grid").kendoGrid({
        dataSource : dataSource,
        pageable : true,           
        height : 430,
        refresh: true,           
        toolbar : ["create"],
        columns : [{
            field : "company",
            title : "Company",
            editor: companyList
        }, {
            field : "effective_date",
            title : "Effective Date"
        }, {
            field : "fee",
            title : "Fee"
        }, {
            field : "guarantee",
            title : "Guarantee"
        }, {
            field : "state",
            title : "State",
            editor: stateList
        },
        {
            field : "application",
            title : "Application",
            editor: appList           
        },
        {
            command : ["edit", "destroy"],
            title : " ",
            width : "160px"
        }],
        editable : "inline"
    });
  2. Rich
    Rich avatar
    22 posts
    Member since:
    Feb 2012

    Posted 16 Jul 2013 Link to this post

    Turns out it was malformed JSON... it was returning a number where a string was called for (user had entered in a number in a free form text box) and JSON was returning it without being quoted.
  3. Kendo UI is VS 2017 Ready
  4. Kiril Nikolov
    Admin
    Kiril Nikolov avatar
    2565 posts

    Posted 17 Jul 2013 Link to this post

    Hi Richard,

    I am glad you found the problem and it worked.

    If you need any assistance, please do not hesitate to contact us.
     
    Regards,
    Kiril Nikolov
    Telerik
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top