Quantcast
Channel: Telerik Forums RSS
Viewing all articles
Browse latest Browse all 94857

Update function in Kendo UI Grid (using with AngularJs) never fires, using with Local Data

$
0
0

We are evaluating Kendo UI for one of our projects, but having some issues with Kendo UI Grid as described below :

I have a Kendo UI grid, which is bound to an KendoObservableArray. I am using inline edit mode. And my options are declared as below :

valueMapCtrl.lookupMappingDetails = newkendo.data.ObservableArray([]);
 
        valueMapCtrl.gridOptions = {
            dataSource: newkendo.data.DataSource({
                type: "json",
                transport: {
                    read: function(options) {
                        options.success(valueMapCtrl.lookupMappingDetails);
                    },
                    update: function(options) {
                        console.log("Update", options);
                        options.success(options.data);
                    },
                    create: function(options) {
                        console.log("Create", options);
                        options.data.mappingId = mappingId;
                        mappingId = mappingId + 1;
                        options.success(options.data);
                    },
                    destroy: function(options) {
                        console.log("Delete", options);
                        options.success(options.data);
                    }
                },
                change: function(e) {
                    console.log("change: "+ e.action);
                    // do something with e
                },
                error: function(e) {
                    // handle error
                    alert("Status: "+ e.status + "; Error message: "+ e.errorThrown);
                },
                //data: valueMapCtrl.dynamicData,
                schema: {
                    model: {
                        id: "mappingId",
                        fields: {
                            mappingId: {editable: false, nullable: false, defaultValue: 0},
                            Col1: {
                                type: "string",
                                validation: {
                                    required: true
                                }
                            },
                            Col2: {
                                type: "string",
                                validation: {
                                    required: true
                                }
                            }
                        }
                    }
                },
                pageSize: 10,
                batch: false
 
            }),
            columns: [{
                field: "col1",
                title: "Column 1"
            }, {
                field: "col2",
                title: "Column 2"
            }, {
                command: /*"destroy"*/["edit", "destroy"],
                title: " ",
                width: "200px"
            }],
            selectable: "multiple cell",
            allowCopy: "true",
            //save: function (e) {
            //    console.log("Save", e);
            //},
            toolbar: ["create"],
            height: 300,
            navigatable: true,
            filterable: true,
            sortable: true,
            pageable: true,
            editable: "inline"
        };

Add record : create fires correctly
Delete record: destroy fires correctly
Update record : nothing happens, no error, all I see in change event sync() action.
But If I declare save as well in my options, that fires correctly.

save: function(e) {
            console.log("Save", e); //This fires on each update
        }
 I am not sure what is wrong in above declaration; browsed through a lot of forums/questions for similar issue but could not get it working. Any help ?

Viewing all articles
Browse latest Browse all 94857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>