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

Cancel on edit giving error

2 Answers 29 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Richard
Top achievements
Rank 1
Richard asked on 15 Jul 2013, 07:50 PM
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 Answers, 1 is accepted

Sort by
0
Richard
Top achievements
Rank 1
answered on 16 Jul 2013, 03:38 PM
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.
0
Kiril Nikolov
Telerik team
answered on 17 Jul 2013, 07:57 AM
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!
Tags
Grid
Asked by
Richard
Top achievements
Rank 1
Answers by
Richard
Top achievements
Rank 1
Kiril Nikolov
Telerik team
Share this question
or