Grid force update

by OnaBai

HTML

<link rel="stylesheet" href="http://cdn.kendostatic.com/2013.2.716/styles/kendo.common.min.css">
<link rel="stylesheet" href="http://cdn.kendostatic.com/2013.2.716/styles/kendo.default.min.css">
<script src="http://cdn.kendostatic.com/2013.2.716/js/jquery.min.js"></script>
<script src="http://cdn.kendostatic.com/2013.2.716/js/kendo.all.min.js"></script>
<script src="http://demos.kendoui.com/content/shared/js/people.js"></script>
When you click <button class="k-button" id="update">Here</button> I will force an update of the first element.
If it works, you should see an alert saying update and the data of the first row.
<div id="grid"></div>

JavaScript

var grid = $("#grid").kendoGrid({
    dataSource: {
        transport: {
            read   : function (op) {
                op.success(createRandomData(50))
            },
            update : function (op) {
                alert("update : " + JSON.stringify(op.data));
                op.success(op.data)
            }
        },
        pageSize : 10,
        schema   : {
            model: {
                id    : "Id",
                fields: {
                    Id       : { type: 'number' },
                    FirstName: { type: 'string' },
                    LastName : { type: 'string' }
                }
            }
        }
    },
    editable  : "popup",
    pageable  : {
        refresh  : true,
        pageSizes: true
    },
    columns   : [
        { command: "edit", width: 60 },
        { field: "FirstName", width: 90, title: "First Name" },
        { field: "LastName", width: 90, title: "Last Name" }
    ]
}).data("kendoGrid");

$("#update").on("click", function() {
    var data = grid.dataSource.data()[0];
    data.dirty = true;
    grid.saveChanges();
})