Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
365
igGrid doesn't reflect saved changes
posted

I am using the igGrid with a web API that saves changes similar to the way an MVC controller does. I have confirmed that the data from the igGrid is sent to the web API correctly (it is actually saved to the database). The only remaining problem is that the grid still shows deleted rows with a strikethrough and added/modified rows in italics.

Here's the JavaScript for the igGrid:

                $("#grid1").igGrid({
                    dataSource: "/api/processes",
                    updateUrl: "/api/processes/save",
                    primaryKey: "processID",
                    autoGenerateColumns: false,
                    height: "350px",
                    width: "800px",
                    columns: [
                            { headerText: "Process ID", key: "processID", dataType: "number" },
                            { headerText: "Name", key: "name", dataType: "string" },
                    ],
                    features: [
                            {
                                name: "Updating",
                                editMode: 'cell',
                                columnSettings: [{
                                    columnKey: 'processID',
                                    readOnly: true
                                }]
                            }
                    ]
                });

And here is the response I'm returning from my web API:

JsonResult result = new JsonResult();
Dictionary<string, bool> response = new Dictionary<string, bool>();
response.Add("Success", true);
result.Data = response;
return result;

The result translates to this JSON: {"data":{"Success":true},"jsonRequestBehavior":"DenyGet"}

I also tried returning {"Success":true}

My question is: What should I return from the web API to tell the igGrid that data was saved successfully so it will make deleted rows disappear and turn off italics on added and modified rows?

Thanks in advance.

Parents
No Data
Reply
  • 5513
    Verified Answer
    Offline posted

    Hello,

    When using WebAPI you shouldn't wrap your response in an ActionResult derivative. Try returning the dictionary directly:

            public Dictionary<string, bool> Post()
            {
                Dictionary<string, bool> response = new Dictionary<string, bool>();
                response.Add("Success", true);
                return response;
            }

    Hope this helps! Please, let me know if you have any other questions and/or concerns!

    Best regards,

    Stamen Stoychev

Children