Issue with Update

3 posts, 1 answers
  1. Mukilan
    Mukilan avatar
    2 posts
    Member since:
    Aug 2017

    Posted 10 Aug 2017 Link to this post

    Hi,

    Am new to Kendo UI Grid, am trying to integrate Kendo with Domino API. Well for updating my backend doc i kind of need to use PATCH, but am trying to use this in Kendo the backend document are getting updated but not reflecting in frontend unless i do a refresh. Below is my sample code. Can someone please help me with this.

     

    function loadKendoGrid(){
     $(document).ready(function () {  
    var dataSource = new kendo.data.DataSource({
                    transport: {
                        read: {
                            url: "/testDB/sample.nsf/api/data/collections/name/locWiseAllNew",
                            dataType: "json"
                          },                    
                        update: {
                            url: function(options) {
                                return "/testDB/sample.nsf/api/data/documents/unid/" + options["@unid"]
                            },
                            contentType: "application/json",
                            type: "PATCH",
                            dataType: "json"
                          },                        
                        destroy: {
                         url: function(options) {
                              return "/testDB/sample.nsf/api/data/documents/unid/" + options["@unid"]
                          },
                          type: "DELETE"
                          },
                        parameterMap: function(options, operation) {                      
                            if (operation == "update" && options) {  
                            var sendData = {};
                            sendData["Charge"] = options["Charge"];
                            sendData["FMNO"] = options["FMNO"];
                            sendData["CSS"] = options["CSS"];
                                return kendo.stringify(sendData);
                                }       
                           }
                        },
                        error: function(r){
                        console.log(r)
                        },
                        schema: {
                        model: {
                        id: "unid",
                            fields: {
                          unid : {type: "string", editable: false, nullable: true },
                          $39: { type: "string", editable: false },
                          $83: { type: "string", editable: false },
                          $91: { type: "string", editable: false },
                          Charge: { type: "string" },
                          $53: { type: "string", editable: false },
                          FMNO:{ type: "string" },
                          $94: { type: "number", editable: false },
                           $95:{ type: "number", editable: false },
                           CSS: { type: "string"}
                            }
                        }
                    },    
                    pageSize: 20
                });
    $("#grid").kendoGrid({
    dataSource: dataSource,
                height: 300,
                filterable: true,
                sortable: true,
                pageable: true,
                editable: "inline",
                columns: [ {
                        field: "$39",
                        title: "Day"
                    },
                    {
                        field: "$83",
                        title: ""
                    },
                    {
                        field: "$91",
                        title: "CSS"
                    },
                    {
                        field: "Charge",
                        title: "Charge"
                    },
                    {
                        field: "$53",
                        title: "VA"
                    },
                    {
                        field: "VAincharge_FMNO",
                        title: "FMNO"
                    },
                    {
                        field: "$94",
                        title: "RT"
                    },
                    {
                        field: "$95",
                        title: "OT"
                    },
                    {
                        field: "CSS",
                        title: "CSS"
                    },
                    { command: ["edit", "destroy"], title: " ", width: "250px" }
                ]
            });
     });  
    }
  2. Answer
    Boyan Dimitrov
    Admin
    Boyan Dimitrov avatar
    2062 posts

    Posted 11 Aug 2017 Link to this post

    Hello Mukilan,

    The Kendo UI DataSource expects the updated item to be returned from the update back end method. Could you please provide the response returned from the update method? 

    Regards,
    Boyan Dimitrov
    Progress Telerik
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  3. Mukilan
    Mukilan avatar
    2 posts
    Member since:
    Aug 2017

    Posted 11 Aug 2017 in reply to Boyan Dimitrov Link to this post

    Hi Boyan,

    Thanks for your turn around. Am able to get it working, since domino access API doesn't give a response when we use the PATCH method I was not able to get this working, however am using the 'complete' event of 'update' to trigger the 'read' transport again. Also looks like Kendo doesn't support editing multiple rows when the response JSON consist of @ as prefix in the key. For this am using the SCHEMA parser to correct my JSON.

    [ { "@href":"\/IT\/Appdev\/QA6\/Bookings_Archive_June_2017.nsf\/api\/data\/collections\/name\/locWiseAllNew\/unid\/5BA039200DB8885165258171004069B9", "@link": { "rel":"document", "href":"\/IT\/Appdev\/QA6\/Bookings_Archive_June_2017.nsf\/api\/data\/documents\/unid\/5BA039200DB8885165258171004069B9" }, "@entryid":"1-5BA039200DB8885165258171004069B9", "@unid":"5BA039200DB8885165258171004069B9", "@noteid":"B12", "@position":"1", "@read":true, "@siblings":5, "@form":"Memo", "$39":"07 July", "$83":"21-Jul-17", "$91":"PS22", "Charge":"XXX1", "$53":"Mukilan A", "VAincharge_FMNO":"68978", "$94":4, "$95":5, "CSS":"PS22", "unid":"5BA039200DB8885165258171004069B9" },

Back to Top