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

Update not triggering when editing

2 Answers 546 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Cyndie
Top achievements
Rank 1
Cyndie asked on 16 May 2012, 04:08 PM
I'm using build 2012.0 515 with jquery 1.7.1 and IE9.  I have a grid and want to configure inline editing with a web service.  The read transport works fine and my grid is populated with data.  If I click edit, change a value, then click save, the value in the grid is changed, but the update transport is not triggered.  So, if I refresh the page, the original values are back because they were not updated in the database.  There are no errors, but my web service for update is never called.  Should this trigger automatically as one of the built-in commands or do I need to do something to force it to trigger?

I've looked at the example for asmx services here:
https://github.com/telerik/kendo-examples-asp-net/blob/master/grid-web-service-crud/Default.aspx

I have added the HTTP GET and HTTP POST to my web.config file.  (My service is an intranet service, so I cannot use jsfiddle to demonstrate my issue). 

grid:
$("#grid").kendoGrid({
    dataSource: maxSource,
    toolbar: ["create"],
    columns: [
        { field: "MaximoItemNumber", title: "Maximo Item #" },
        "KVA",
        { field: "PrimaryVoltage", title: "Primary Voltage" },
        { field: "SecondaryVoltage", title: "Secondary Voltage" },
        { field: "OilType", title: "Oil Type" },
        "Phase",
        { command: ["edit", "destroy"], title: " "}
    ],
    editable: "inline"
});


datasource:
var maxSource = new kendo.data.DataSource({
    transport: {
        create: {
            url: webServiceBaseUrl + "createMaxItem",
            contentType: 'application/json; charset=utf-8',
            type: "POST",
            dataType: "json"
        },
        read: {
            url: webServiceBaseUrl + "getMaxItems",
            contentType: 'application/json; charset=utf-8',
            type: "POST",
            dataType: "json"
        },
        update: {
            url: webServiceBaseUrl + "updateMaxItem",
            contentType: 'application/json; charset=utf-8',
            type: "POST",
            dataType: "json"
        },
        destroy: {
            url: webServiceBaseUrl + "deleteMaxItem",
            contentType: 'application/json; charset=utf-8',
            type: "POST",
            dataType: "json"
        },
        parameterMap: function(data, operation) {
            if (operation != "read") {
                return JSON.stringify( { stuff: data.models } );
            }
        }
    },
    schema: {
            data: "d",
            id: "id",
            fields: {
                id: { editable: false, nullable: true },
                MaximoItemNumber: { validation: { required: true} },
                KVA: { type: "number" },
                PrimaryVoltage: { type: "string" },
                SecondaryVoltage: { type: "string" },
                OilType: { type: "string" },
                Phase: { type: "number" },
                DateAdded: { type: "datetime" },
                AddedBy: { type: "string" }
        }
    }
});

2 Answers, 1 is accepted

Sort by
0
Accepted
Alexander Valchev
Telerik team
answered on 18 May 2012, 11:30 AM
Hello Cyndie,

I tried to reproduce this issue in IE9 with our inline editing demo (v.2012.1.515), but to no avail. Could you please check the screen cast and let me know if I missed something?

In addition I noticed a mistake in your dataSource configuration - the id and fields should be properties of the model.
schema: {
        data: "d",
        model: {
            id: "id",
            fields: {
                id: { editable: false, nullable: true },
                MaximoItemNumber: { validation: { required: true} },
                KVA: { type: "number" },
                PrimaryVoltage: { type: "string" },
                SecondaryVoltage: { type: "string" },
                OilType: { type: "string" },
                Phase: { type: "number" },
                DateAdded: { type: "datetime" },
                AddedBy: { type: "string" }
            }
        }
}


Regards,
Alexander Valchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Cyndie
Top achievements
Rank 1
answered on 18 May 2012, 01:09 PM
I tried to respond to the thread earlier as I resolved this, but received an error.  I did find that I needed to have 'id' and 'field' in a model and that worked.

Thanks.
Tags
Grid
Asked by
Cyndie
Top achievements
Rank 1
Answers by
Alexander Valchev
Telerik team
Cyndie
Top achievements
Rank 1
Share this question
or