Kendo UI grid update


username

I'm using a Kendo UI grid with a service that requires a POST request to update the row as a JSON string instead of a URL encoded form.

My grid datasource configuration looks like this:

dataSource: new kendo.data.DataSource({
    transport: {
        read: "/Service.svc/instructors",
        update: {
            url: "/Service.svc/instructors",
            type: "POST",
            contentType: "application/json; charset=utf-8",
            data: function (data) {
                return kendo.stringify(data);
            }
        }
    },
    //...
});

But the body of the request ends up looking like this:

0=%7B&1=%22&2=I&3=d&4=%22&5=:&6=%20&7=1&8=,&9=%20&10=%22&11=F&12=o&13=o&14=%22&15=:&16=%20&17=%22&18=f&19=o&20=o&21=%22&22=,&23=%20&24=%22&25=B&26=a&27=r&28=%22&29=:&30=%20&31=%22&32=b&33=a&34=r&35=%22&36=%7D&Id=1&Foo=foo&Bar=bar

Encoded json object ( {"Id": 1, "Foo": "foo", "Bar": "bar"}) (what encoding, btw?) plus form data.

Using jQuery directly works fine:

$.ajax({
    type: "POST", 
    url: "/Service.svc/instructors", 
    data: kendo.stringify({Id: 1, Foo: "foo", Bar: "bar"}),
    contentType:"application/json; charset=utf-8",
    dataType: "json",
    success: function(data) { console.log(data);}
});

According to the documentation , I should be able to set update as a function and call it, but apparently, this hasn't worked since 2012 .

How do I get Kendo to post the correct data?

Peak encoding

It's not intuitive or well documented, but you want to call JSON.stringify()the parameterMapfunction:

var productsDataSource = new kendo.data.DataSource({
    transport: {
        read: {
            url: "/Products"
        },
        update: {
            type: "POST",
            url: "/Products/Edit",
            dataType: "json",
            contentType: "application/json"
        },
        parameterMap: function(data, operation) {
            if (operation === "update" || operation === "create") {
                return JSON.stringify({product: data});
            }
            return data;
        }
    },
    schema: {
        model: {
            id: "ProductID",
            fields: {
                Name: { type: "string" },
                ListPrice: { type: "number" },
                SellStartDate: { type: "date" }
            }
        }
    }
});

Related


Kendo UI grid update

username I'm using a Kendo UI grid with a service that requires a POST request to update the row as a JSON string instead of a URL encoded form. My grid datasource configuration looks like this: dataSource: new kendo.data.DataSource({ transport: {

Kendo ui grid (if other conditions)

pilot What's wrong with my code? I have to check in the kendo UI grid if there is "OrderType 20" in the column. If so, I need to apply the css condition that includes the background, but it doesn't work, can anyone help me? thanks template: '# if (OrderType ==

Kendo UI grid binds twice

Trevor Goode Inherited a Kendo app I'm trying to fix and really stuck here. I have a search page bound to a datasource twice and can't figure it out. Here is the grid code: @(Html.Kendo().Grid<Flex.Models.AddEntryEditModel>() .Name("EventGrid") .Column

Kendo UI Grid replacement fee

Juancho Ramone Are there any free/open source alternatives to Kendo UI Grid? I used to use the Grid module included in the free version, but don't use it anymore because it's too expensive for me because I only need the Grid module. Jarno Lahtinen I don't know

Kendo ui grid (if other conditions)

pilot What's wrong with my code? I have to check in the kendo UI grid if there is "OrderType 20" in the column. If so, I need to apply the css condition that includes the background, but it doesn't work, can anyone help me? thanks template: '# if (OrderType ==

Kendo UI grid dropdown and angular

Dalton 5 I try to set custom dropdown menu in Kendo UI. I have mentioned my problem. http://dojo.telerik.com/aFIZa/13 My problem is that I don't know how to set the selected text in the template property? I want to display the text field but save the ID as a v

Kendo UI Grid replacement fee

Juancho Ramone Are there any free/open source alternatives to Kendo UI Grid? I used to use the Grid module included in the free version, but don't use it anymore because it's too expensive for me because I only need the Grid module. Jarno Lahtinen I don't know

Kendo UI Grid - Grouping Header

Ice Whisperer I want to implement Collapse/Expand all (in AngularJs) functionality for a grouped Kendo UI Grid and add it to the header of the Grid. Do you know how I can put my function there (see attached). Thanks! Dojo with normal grid with active grouping

Kendo UI Grid with CSS Reference

blind I'm trying to write code that must conform to certain rules. Currently, I'm working on a part that looks like this: <head><link rel="stylesheet" href="Site.css"></head> <div class="row"> <div class="col-md-12"> @(Html.Kendo() .Gr

Kendo UI grid undefined decimal

Daniel Gustafson Here is my grid: $("#grid").kendoGrid({ dataSource: { type: "odata", transport: { read: { url: '/Discount/Get', dataType: "jsonp", type: "POST" },

Kendo UI grid update

username I'm using a Kendo UI grid with a service that requires a POST request to update the row as a JSON string instead of a URL encoded form. My grid datasource configuration looks like this: dataSource: new kendo.data.DataSource({ transport: {

Update Kendo Grid with Ajax

Mustafa The problem may be that the RssCek function in the success function HomeController returns successfully. But I can't manage the binding to the return part of the grid HomeController RssCek function return Json(feedler, JsonRequestBehavior.Allow

Kendo UI Grid Hierarchy

Ivan Crojach Karačić What I have is the following DTO passed from the service class ServiceDto { public string Name { get; set; } public string Complete { get; set; } public string Incomplete{ get; set; } public List<ServiceDto> Detail{ get

Kendo UI Web - Grid Create/Update/Delete

no time I'm having issues with Kendo UI Web and datasources. The read works fine, I've serialized the database objects with JSON and am able to view them in the grid. I need some pointers on how to make create, update and delete work. By the way, I'm using the

Kendo UI Grid Hierarchy

Ivan Crojach Karačić What I have is the following DTO passed from the service class ServiceDto { public string Name { get; set; } public string Complete { get; set; } public string Incomplete{ get; set; } public List<ServiceDto> Detail{ get

Kendo UI Web - Grid Create/Update/Delete

no time I'm having issues with Kendo UI Web and datasources. The read works fine, I've serialized the database objects with JSON and am able to view them in the grid. I need some pointers on how to make create, update and delete work. By the way, I'm using the

Kendo UI grid update

username I'm using a Kendo UI grid with a service that requires a POST request to update the row as a JSON string instead of a URL encoded form. My grid datasource configuration looks like this: dataSource: new kendo.data.DataSource({ transport: {

kendo UI grid update function doesn't trigger

username $('#usersGrid').kendoGrid({ columns: [ { field: "UserName", title: "Display name", width: "140px" }, { field: "Unit", title: "Unit", width: "140px" }, { field: "Email", title: "E-mail", width: "140px" },

Kendo UI Grid - Programmatically update to auto-generated textbox

Vapcguy I think one of my questions is similar but not identical to another Stack Overflow question , and it's rather complicated to explain, so I have a lot of details, but I thought it might be possible to answer directly. And, since there are other ways to

Kendo UI - Tooltips in Grid

no time I am trying to create a tooltip for my grid like this: $("#grid").kendoTooltip({ autoHide: true, showOn: "mouseenter", width:125, height:125, position: "right", filter: ".k-grid-content a.hasTooltip", content: kendo.template

UI unresponsive to Kendo grid

Charvari I've been having issues with kendo grids for the following situations. I have a kendo grid with 18 columns. The user can select multiple rows. The number of rows is mostly over 10000. To get the selected row, I am using grid.select(). To extract conte

Kendo UI Grid Hierarchy

Ivan Crojach Karačić What I have is the following DTO passed from the service class ServiceDto { public string Name { get; set; } public string Complete { get; set; } public string Incomplete{ get; set; } public List<ServiceDto> Detail{ get

Kendo UI Web - Grid Create/Update/Delete

no time I'm having issues with Kendo UI Web and datasources. The read works fine, I've serialized the database objects with JSON and am able to view them in the grid. I need some pointers on how to make create, update and delete work. By the way, I'm using the

kendo UI grid update function doesn't trigger

username $('#usersGrid').kendoGrid({ columns: [ { field: "UserName", title: "Display name", width: "140px" }, { field: "Unit", title: "Unit", width: "140px" }, { field: "Email", title: "E-mail", width: "140px" },

Kendo UI - Tooltips in Grid

no time I am trying to create a tooltip for my grid like this: $("#grid").kendoTooltip({ autoHide: true, showOn: "mouseenter", width:125, height:125, position: "right", filter: ".k-grid-content a.hasTooltip", content: kendo.template

UI unresponsive to Kendo grid

Charvari I've been having issues with kendo grids for the following situations. I have a kendo grid with 18 columns. The user can select multiple rows. The number of rows is mostly over 10000. To get the selected row, I am using grid.select(). To extract conte

Update Kendo Grid with Ajax

Mustafa The problem may be that the RssCek function in the success function HomeController returns successfully. But I can't manage the binding to the return part of the grid HomeController RssCek function return Json(feedler, JsonRequestBehavior.Allow